Thomas Morley <thomasmorle...@gmail.com> writes: > Am Mo., 31. Dez. 2018 um 10:43 Uhr schrieb Malte Meyn <lilyp...@maltemeyn.de>: >> >> >> >> Am 31.12.18 um 09:58 schrieb Andrew Bernard: >> > >> > Why do you have to use cadr and not cdr on the ly:grob-set-property >> > line? Isn't the broken part the second item in a list of two items? How >> > to understand this? >> >> In Scheme, a list is a pair, containing the head/car (first element of >> the list) and tail/cdr (sublist of all other elements). A list >> containing only one element is a pair of that element and an empty list '(). >> >> '(1 2 3 4 5) >> is the same as >> '(1 . (2 . (3 . (4 . (5 . ())))) >> >> So the car of the list above is 1, the cdr is '(2 3 4 5). If you want to >> get the 2, you have to take the car of '(2 3 4 5). And cadr is short for >> “car of cdr”. > > Or use 'second' a srfi-1-procedure, which provided by LilyPond as > default: (second '(1 2 3)) > Or 'list-ref': (list-ref '(1 2 3) 1) NB first element of a list is at > position zero.
Natural language cardinals: zero one two three Natural language ordinals: first second third Scheme cardinals: 0 1 2 3 Scheme ordinals: 0 1 2 C is similar. Any wonder that off-by-one errors are so popular? -- David Kastrup _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user