[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Parenthensize a horizontal group?
From: |
Mark Probert |
Subject: |
Re: Parenthensize a horizontal group? |
Date: |
Sat, 28 Aug 2021 11:02:02 +1000 |
Lukas wrote:
>
>>> parenthesizeMusic function
>
> Make that ...
>>
> Explanation: The additional (if (pair? (cdr evs)) ...) checks if
> there's more than one rhythmic event in the given music before
> parenthesising the last event and cancelling the unnecessary half of
> each pair of parentheses.
>
> (Why this works: evs is a list of events (a b ...). Now (cdr evs) is
> the tail (b ...) of that list. This is non-empty iff it is a pair,
> since scheme lists are internally nested pairs: '(1 2 3) is '(1 . (2
> . (3 . ()))) - which is also the reason why cdr, which returns the
> second element of a pair, returns the tail of a list.)
>
Thank both for the fix and the excellent explanation. Greatly
appreciated!
.. mark.