lilypond-user
[Top][All Lists]
Advanced

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

Re: Procedure for set-paper-size in \paper ?


From: Thomas Morley
Subject: Re: Procedure for set-paper-size in \paper ?
Date: Sat, 19 May 2018 01:03:43 +0200

2018-05-19 0:36 GMT+02:00 Aaron Hill <address@hidden>:
> On 2018-05-18 14:24, Thomas Morley wrote:

>> #(define (proc bool x y)
>>   (if bool x y))

> Your `proc` function does not have this behavior, as the arguments passed in
> will be evaluated before you get to the inner `if`.

Hm, then I should reword my request.
Is there a way to circumvent this behaviour?

I'm finally aiming at a function selecting from different set-whatever!

> Now, `set-paper-size`
> has a side-effect, so the evaluation of that function alone is enough to
> have an impact.  Technically, the function should be named
> `set-paper-size!`, as the convention is to suffix an exclamation to indicate
> such functions.
>
> So, calling `proc` with the two functions results in both being evaluated,
> which is not what you want.

Ok, then another example for this would be:

#(define (proc bool x y)
  (if bool x y))

#(define lst #f)

#(proc #f (set! lst '(1 2)) (set! lst '(3 4)))

#(write lst)

always returns:
'(3 4)

>
> Your `apply` approach is closer to what you want, since you are using `proc`
> as a means of selecting the arguments you want and calling `set-paper-size`
> only once.  This should work, except you have an extra quote.
>
> %%%%
>   #(apply set-paper-size (proc #t '("a8" landscape) '("a8")))
> %%%%
>
> The outer quote for invoking the list shorthand already results in
> `landscape` being a symbol.  The extra quote would put another layer of
> indirection, which `set-paper-size` does not expect.

Ok, it's an overside then.
Thanks for spotting it.

>
> Hope this helps,
>
> -- Aaron Hill

It helped a lot.

Many thanks,
  Harm



reply via email to

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