lilypond-user
[Top][All Lists]
Advanced

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

Re: Flat flared hairpins


From: David Kastrup
Subject: Re: Flat flared hairpins
Date: Mon, 31 Dec 2018 13:55:43 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Thomas Morley <address@hidden> writes:

> Am Mo., 31. Dez. 2018 um 10:43 Uhr schrieb Malte Meyn <address@hidden>:
>>
>>
>>
>> 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



reply via email to

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