[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
syntax helper for ly:music-property
From: |
Nicolas Sceaux |
Subject: |
syntax helper for ly:music-property |
Date: |
Sun, 13 Jun 2004 18:41:56 +0200 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Hello,
Manipulating music expressions makes me impatient and lazy (don't know
about hubris). Here is a little utility which can be used as a
shortcut for ly:music-property :
(define (read-dotted-expression chr port)
(define (gen-music-prop-expr music prop . rest)
(if (null? rest)
`(ly:music-property ,music ',prop)
(apply gen-music-prop-expr `(ly:music-property ,music ',prop) rest)))
(let ((tokens (map string->symbol (string-split (symbol->string (read port))
#\.))))
(apply gen-music-prop-expr tokens)))
(read-hash-extend #\@ read-dotted-expression)
It has some limitations: the symbols (music variable and property
names) must not have dots. Example of use:
guile> (define toto (car (ly:music-property #{ \override TextScript #'padding =
#4 #} 'elements)))
guile> (mus:display toto)
(make-music 'ContextSpeccedMusic
'property-operations ()
'context-type 'Bottom
'element (make-music 'OverrideProperty
'pop-first #t
'grob-property 'padding
'grob-value 4
'symbol 'TextScript))
guile> (mus:display address@hidden)
(make-music 'OverrideProperty
'pop-first #t
'grob-property 'padding
'grob-value 4
'symbol 'TextScript)
guile> (set! address@hidden 'extra-offset)
guile> (set! address@hidden (cons 1 2))
guile> (mus:display toto)
(make-music 'ContextSpeccedMusic
'property-operations ()
'context-type 'Bottom
'element (make-music 'OverrideProperty
'pop-first #t
'grob-property 'extra-offset
'grob-value (1 . 2)
'symbol 'TextScript))
guile> (let ((override-property address@hidden))
(set! address@hidden (cons 2 3)))
guile> (mus:display toto)
(make-music 'ContextSpeccedMusic
'property-operations ()
'context-type 'Bottom
'element (make-music 'OverrideProperty
'pop-first #t
'grob-property 'extra-offset
'grob-value (2 . 3)
'symbol 'TextScript))
guile>
nicolas
- syntax helper for ly:music-property,
Nicolas Sceaux <=
- Re: syntax helper for ly:music-property, Nicolas Sceaux, 2004/06/13
- Re: syntax helper for ly:music-property, Han-Wen Nienhuys, 2004/06/18
- Re: syntax helper for ly:music-property, Nicolas Sceaux, 2004/06/19
- Re: syntax helper for ly:music-property, Jan Nieuwenhuizen, 2004/06/19
- Re: syntax helper for ly:music-property, Han-Wen Nienhuys, 2004/06/19
- Re: syntax helper for ly:music-property, Jan Nieuwenhuizen, 2004/06/19
- Re: syntax helper for ly:music-property, Nicolas Sceaux, 2004/06/19