[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Lilypond-auto] Issue 2607 in lilypond: Patch: Allow immediate Schem
From: |
David Kastrup |
Subject: |
Re: [Lilypond-auto] Issue 2607 in lilypond: Patch: Allow immediate Scheme expressions to take multiple values |
Date: |
Fri, 22 Jun 2012 07:33:24 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) |
"Trevor Daniels" <address@hidden> writes:
>> Comment #16 on issue 2607 by address@hidden: Patch: Allow immediate Scheme
>> expressions to take multiple values
>> http://code.google.com/p/lilypond/issues/detail?id=2607
>>
>> Good idea documenting this, though. That way people have a chance to
>> notice.
>
> :) I've noticed, and I've read it, twice, but I still don't understand
> it sufficiently to formulate a sensible comment. Sorry :(
Then the documentation is insufficient.
$@(list a b ...) is equivalent to $a $b $...
The inspiration for this ,@ is described as
If an `(unquote-splicing <expression> ...)' form appears inside a
<qq template>, then the <expression>s must evaluate to lists; the
opening and closing parentheses of the lists are then "stripped
away" and the elements of the lists are inserted in place of the
`UNQUOTE-SPLICING' form.
Any `UNQUOTE-SPLICING' or multi-operand `UNQUOTE' form must appear
only within a list or vector <qq template>.
The following abbreviations may be used:
(quasiquote <qq template>) = `<qq template>
(unquote <expression>) = ,<expression>
(unquote-splicing <expression>) = ,@<expression>
Examples:
`(list ,(+ 1 2) 4) => (list 3 4)
(let ((name 'a))
`(list ,name ',name)) => (list a (quote a))
`(a ,(+ 1 2) ,@(map abs '(4 -5 6)) b) => (a 3 4 5 6 b)
`((foo ,(- 10 3))
,@(cdr '(c)) . ,(car '(cons))) => ((foo 7) . cons)
`#(10 5 ,(sqrt 4) ,@(map sqrt '(16 9)) 8)
=> #(10 5 2 4 3 8)
Suggestions for improving the docs?
--
David Kastrup