lilypond-user
[Top][All Lists]
Advanced

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

Re: Using Scheme inside Lilypond


From: Richard Shann
Subject: Re: Using Scheme inside Lilypond
Date: Sat, 04 Sep 2021 20:30:11 +0100

On Sat, 2021-09-04 at 20:44 +0200, David Kastrup wrote:
> Richard Shann <richard@rshann.plus.com> writes:
> 
> > Can someone educate me as to why this works:
> > 
> > \markup \path #0.4 #'((moveto 0 0) (lineto -30 50) (lineto -20 80)
> > (closepath))
> > 
> > but this does not:
> > 
> > \markup \path #0.4 #'((moveto 0 0) (lineto -30 (* 2 25)) (lineto
> > -20 80) (closepath))
> > 
> > The difference being I replace 50 with (* 2 25)
> > 
> > (I'm trying to write code that will draw a box round A4 or letter
> > paper
> > with just a change of some scaling factors - I can work around it
> > but
> > it's distressing not to understand what is going on).
> 
> (* 2 25) is a list with 3 elements, the symbol * and the numbers 2
> and
> 25.  In a list quoted with ' Scheme has no incentive to evaluate an
> expression.  You could use a quasiquote (a backtick instead of a
> tick)
> to gain the capability of using a comma for temporary evaluation of
> one
> expression, namely
> 
> \markup \path #0.4 #`((moveto 0 0) (lineto -30 ,(* 2 25)) (lineto -20
> 80) (closepath))
> 
> Numeric constants like 0 and -30 are self-quoting, so putting ,
> before
> them does not make a difference.

Thank you - and to Aaron too, I knew it must be something like that,
but only tried the , operator forgetting (if I ever knew) about `
Now I'm cooking with gas...
Richard








reply via email to

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