lilypond-user
[Top][All Lists]
Advanced

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

Re: Variable equivalent in Scheme


From: Aaron Hill
Subject: Re: Variable equivalent in Scheme
Date: Sat, 09 Nov 2019 21:24:55 -0800
User-agent: Roundcube Webmail/1.3.8

On 2019-11-09 5:37 pm, Freeman Gilmore wrote:
If:
       traLaLa = { c'4 d'4 }
How would I write this in Scheme?
       #(define traLaLa  ?)

You can quote LilyPond syntax within Scheme using the #{ #} tokens:

%%%%
#(define traLaLa #{ { c'4 d'4 } #})
%%%%

You can also define music purely in Scheme:

%%%%
#(define traLaLa
  (make-music
    'SequentialMusic
    'elements
    (list (make-music
            'NoteEvent
            'duration
            (ly:make-duration 2)
            'pitch
            (ly:make-pitch 0 0))
          (make-music
            'NoteEvent
            'duration
            (ly:make-duration 2)
            'pitch
            (ly:make-pitch 0 1)))))
%%%%

NOTE: The above expression I obtained using the following snippet. I doubt I know LilyPond internals well enough to be able to type that monstrosity from memory.

%%%%
\version "2.19.83"
\displayMusic { c'4 d'4 }
%%%%


-- Aaron Hill



reply via email to

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