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.