lilypond-devel
[Top][All Lists]
Advanced

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

Re: Question about 'back quote' in scheme markups within Documentation e


From: David Kastrup
Subject: Re: Question about 'back quote' in scheme markups within Documentation examples
Date: Wed, 09 Jun 2010 18:41:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Carl Sorensen <address@hidden> writes:

> On 6/9/10 7:34 AM, "James Lowe" <address@hidden> wrote:
>
>> Hello,
>> 
>> Going on from the 'curly quotes' problem that was resolved a couple of
>> days back in our documentation, I noticed in the NR while scanning
>> through another 'odd' single quote mark after the hash (#) character.
>> 
>> \override #`(direction . ,UP)
>
> This has UP evaluated at the time the cons cell is made.
>> 
>> instead of
>> 
>> \override #'(direction . ,UP)
>
> This is incorrect.  The alternative syntax would be
>
> \override #'(direction . UP)
>
> which would put the symbol UP in the cons cell.

A correct equivalent alternative would be

\override #(cons 'direction UP)

It is my personal opinion that it would be best to avoid making data
structures that require the user to revert to backcomma as the only
alternative for readable results.

One way to get closer to that is to use (self-evaluating) keywords.  Of
course,

\override #(cons #:direction UP)

does not seem like an improvement at first glance.  It does have the
advantage that functions defined with define* and called with
keyword/value pairs have a natural way of dealing with them.  Also
keywords make clear that 'direction (which is actually translated into
(quote direction) by the reader, and into a symbol by the Lisp
evaluator, and thus is a nuisance for macro expansion which sits in
between) is not used for the purpose of delaying evaluation, but as a
tag.

> The back-quote means that any expression in the back-quoted list that
> is preceded by a comma will be evaluated.

And anything preceded by ,@ will be evaluated and folded into the
surrounding list.

> The regular single quote means that nothing in the list will be
> evaluated; the list will just be assembled.

It is instructive to see what happens to `(whatever ,whatever) inside of
a '-quoted list.

-- 
David Kastrup




reply via email to

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