[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
trying to learn scheme...
From: |
Wilbert Berendsen |
Subject: |
trying to learn scheme... |
Date: |
Sat, 13 Oct 2007 15:26:51 +0200 |
User-agent: |
KMail/1.9.7 |
I am currently learning Scheme to master lilypond even better....
but I miss some clear docs about music-map and define-music-function.
I try to write a function that replaces pitches in a repetitive pattern
(e.g. : c8 d16 c d8 c d16 c d8 c d ) with other pitches.
so that I can say:
myPattern = {c8 d16 c d8 c d16 c d8 c d } %(a global variable)
pat = #(define-music-function (parser location p1 p2) (ly:music? ly:music?)
etc.
and then have \pat aes des' return: aes8 des'16 aes des8 etc.
The function could call music-map to process the pattern, note by note,
replacing the pitches with the pitches in p1 and p2, but I'm not sure how I
can give those pitches as well as arguments to the function called by
music-map. Should I nest a (define) to create a function that already
encapsulates the two piches or a lambda expression? I'm not quite sure and
can't get it to work yet :-)
I could use the example in Bach's WK1 prelude, but that's using \applyMusic
and I understood that define-music-function is the preferred way of creating
functions to manipulate music :-)
Met vriendelijke groet,
Wilbert Berendsen
--
http://www.wilbertberendsen.nl/
"You must be the change you wish to see in the world."
-- Mahatma Gandi
- trying to learn scheme...,
Wilbert Berendsen <=