[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: chose module name instead of *anonymous-ly-NN*?
From: |
Nicolas Sceaux |
Subject: |
Re: chose module name instead of *anonymous-ly-NN*? |
Date: |
Sat, 17 Apr 2004 12:45:34 +0200 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Sat, 17 Apr 2004 09:49:46 +0200, Han-Wen a dit :
> address@hidden 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
chose module name instead of *anonymous-ly-NN*?, Han-Wen Nienhuys, 2004/04/17
Re: chose module name instead of *anonymous-ly-NN*?, Jan Nieuwenhuizen, 2004/04/21