Sat, 17 Apr 2004 09:49:46 +0200, Han-Wen a dit :
> [EMAIL PROTECTED] writes:
>> (read-hash-extend #\{ read-lily-expression)
> This is one supercool hack! I didn't know that this was possible.
I think it is borrowed to Common Lisp (read macros), where you can do
elegantly (from /ANSI Common Lisp/ by P. Graham):
(set-macro-character #\} (get-macro-character #\)))
(set-dispatch-macro-character #\# #\{
#'(lambda (stream char1 char2)
(declare (ignore char1 char2))
(loop with (min max) = (read-delimited-list #\} stream t)
for i upfrom min upto max
collect i into accum
finally (return (list 'quote accum)))))
CL-USER> #{2 7}
(2 3 4 5 6 7)
Sat, 17 Apr 2004 09:53:57 +0200, Han-Wen a dit :
> o, btw, this is vulnerable to symlink attacks. It's better to modify
> the lexer slightly so
> ly:parse-string
> is also possible.
That would be very cool!
In the meantime I am trying some hacks to achieve the following:
(define (textoffset dx dy)
#{ \property Voice.TextScript #'offset = #(cons $dx $dy) #})
that would expand in the following:
(define (textoffset dx dy)
(ly:parse-string (format #f " \property Voice.TextScript #'offset = #(cons ~a ~a) "
dx dy)))
and returns, when called, the music expression with the appropriate
values inserted. I don't find it very eleguant, but it may be handy in
user lily code. (I don't think `$' is often used in lily files?)
nicolas
_______________________________________________
Lilypond-devel mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/lilypond-devel