Michael Scheer <[email protected]> writes:

> Hi guys,
>
> how can I access an array (well I think in Scheme that's no real arrays):
>
>> #(define myArr '#(10 20 30))
>
> in such an element in the paper section?
>
>> top-markup-spacing = #'((basic-distance . #f) (minimum-distance
>   . #f) (padding . #f) (stretchability . #f))
>
> I want to set minimum-distance using the first array element, 10. See
> attached code, for an unknown reason all my testing does not produce
> errors, but does not apply the minimum distance.

You are just throwing gibberish at LilyPond in the hope that something
will stick.

  % top-markup-spacing = #'((basic-distance . #f) (minimum-distance . 
(vector-ref myArr 0)) (padding . #f) (stretchability . #f))
  % top-markup-spacing = #'((basic-distance . #f) (minimum-distance . 
#(vector-ref myArr 0)) (padding . #f) (stretchability . #f))
  % top-markup-spacing = #'((basic-distance . #f) (minimum-distance . 
#'(vector-ref myArr 0)) (padding . #f) (stretchability . #f))

  % ALL ABOVE WON'T SHIFT THE TITLE

Your main problem is that all of your assignments start with
   = #'
meaning that _nothing_ that follows will get evaluated.  Which also
means that nothing of the following establishes any relation to the
_variable_ myArr.

So after establishing just _why_ all of those attempts must fail, let's
see what exactly you are throwing at LilyPond in those various cases.

  % top-markup-spacing = #'((basic-distance . #f) (minimum-distance . 
(vector-ref myArr 0)) (padding . #f) (stretchability . #f))

Here minimum-distance is set to a list with the elements 'vector-ref (a
symbol) 'myArr (another symbol) and 0.  This attempt is actually the one
closest to correct: you just need to get LilyPond to _evaluate_ the
value for minimum-distance.  We'll get to that later.

  % top-markup-spacing = #'((basic-distance . #f) (minimum-distance . 
#(vector-ref myArr 0)) (padding . #f) (stretchability . #f))

Here you are setting minimum-distance to a constant _vector_ with the
elements 'vector-ref (a symbol), 'myArr (another symbol) and 0.  #(...)
is constant vector input syntax, so we now have _two_ reasons not to get
an evaluation, one because of the initial #' quote, one because you were
using constant vector input syntax.

  % top-markup-spacing = #'((basic-distance . #f) (minimum-distance . 
#'(vector-ref myArr 0)) (padding . #f) (stretchability . #f))

I have no idea why Guile would even accept that line: #' is not valid
Scheme read syntax.  Are you sure you tried exactly that?

Anyway, since we established that we do not need _more_ quoting rather
than _less_ quoting, how do we get there?  Well, with (unquote ...) for
which there exists the alternative input syntax ,... .  Of course, for
an unquote not to just end up quoted as well, we must not use a full
quote at the beginning (indicated by an apostrophe) but a quasiquote
(indicated by a backtick).  Which gets us to

  top-markup-spacing = #`((basic-distance . #f) (minimum-distance . 
,(vector-ref myArr 0)) (padding . #f) (stretchability . #f))



-- 
David Kastrup


Reply via email to