lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scheme-question about accumulating lists of lists


From: Thomas Morley
Subject: scheme-question about accumulating lists of lists
Date: Fri, 19 Apr 2019 16:35:30 +0200

Hi all,

let's say I've a procedure building a pair of lists. Actually it's a
built-in procedure, so I can't change it.
For the sake of simplicity let's take:
(define (list-pair) (cons '(1 2 3) '(x y z)))
(list-pair) returns ((1 2 3) x y z)
(cdr (list-pair)) returns the second list, i.e. (x y z)
All fine so far.

Now I add another list
(cons '(a b c) (list-pair))  => ((a b c) (1 2 3) x y z)
Now it's starts getting inconveniant to get the last list, i.e. (x y z)
(and I may add an arbitrary number of lists this way)

I could do
(cons '(a b c) (list (car (list-pair)) (cdr (list-pair))))
and to get the last list: (last ...)
Looksy clumsy, though.

Any better method?

Thanks,
  Harm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]