Werner LEMBERG <w...@gnu.org> 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 $@d 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

_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to