lilypond-devel
[Top][All Lists]
Advanced

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

Re: [Lilypond-auto] Issue 2607 in lilypond: Patch: Allow immediate Schem


From: David Kastrup
Subject: Re: [Lilypond-auto] Issue 2607 in lilypond: Patch: Allow immediate Scheme expressions to take multiple values
Date: Fri, 22 Jun 2012 10:22:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

Werner LEMBERG <address@hidden> writes:

>> If I break down the example I listed before, here are a few
>> useful ways of applying it:
>
> This is much easier to understand, thanks.  However:
>
>> ; this $@ produces elements for a sequential music list via map!.  Each
>> ; element is constructed from p, a list of pitches making up a chord,
>> ; and from d, which is a list first containing a duration followed by
>> ; _optional_ articulations, so address@hidden actually can return several 
>> tokens of
>> ; _different_ type.
>
> here I would still like to have an elementary example how mapping
> works, something like
>
>   In general, mapping a procedure over lists create a new list, for
>   example
>
>     (map! + '(1 2 3) '(4 5 6))   =>   (5 7 9)

You must not! not! not! use map! on constant lists.  It may only be used
on lists that are freshly consed together for each use.  For tutorial
use, one would likely use map instead of map! even in my example (and
append-reverse rather than reverse!) in order not to have to explain the
fine points of destructive list operators.

I was not suggesting putting this thing into the Scheme tutorial.  It is
far too complex.  I was merely posting a more advanced Scheme example to
the list to give others (who don't really need the tutorial for working
with Scheme) a good idea what $@ can be useful for.

So that they can come up with better documentation for putting in the
tutorial (or elsewhere) than I did.  I am really bad at writing nice
documentation at the correct level.

-- 
David Kastrup



reply via email to

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