lilypond-user
[Top][All Lists]
Advanced

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

Re: Understanding spacing


From: David Kastrup
Subject: Re: Understanding spacing
Date: Sun, 21 Apr 2013 07:02:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Noeck <address@hidden> writes:

>>>> Second question: Is there a function to change all 4 values without
>>>> typing the whole alist, only the values? …
>>>
>>> Write it using define-scheme-function.
>> 
>> Ok, I just wanted to make sure that I am not reinventing the wheel. I
>> feel now confident to write such a function (I think)
>
>
> Ok, I was too optimistic. Could anyone help me out here, I do not
> understand what's wrong here:
>
> \version "2.17.14"
>
> % this is intended to return an alist with the given values:
> make-spacing = #(define-scheme-function
>      (parser location bdist mdist padd stret)
>      (number? number? number? number?)
>      '((basic-distance . bdist)
>        (minimum-distance . mdist)
>        (padding . padd)
>        (stretchability . stret))
>      )

Your alist maps symbols to symbols.  The values of the parameters bdist,
mdist etc are never accessed.  You probably mean something like
`((basic-distance . ,bdist)
  (minimum-distance . ,mdist) ...
and yes, that's a backquote (in Scheme parlance, a quasiquote) starting
that list.

>  #(display (make-spacing 60 2 3 4))
>  system-system-spacing = #(make-spacing 60 2 3 4)

Anything defined using define-scheme-function is not called from Scheme
but from LilyPond.  It merely returns a Scheme value.  So you use

system-system-spacing = \make-spacing 60 2 3 4

which is actually what you asked for in your original request.

-- 
David Kastrup




reply via email to

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