[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Generating a (#:column ...) list in Scheme
From: |
David Kastrup |
Subject: |
Re: Generating a (#:column ...) list in Scheme |
Date: |
Thu, 08 May 2014 14:19:55 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
Urs Liska <address@hidden> writes:
> Hi,
>
> I have this construct in a function that creates a combined time signature:
>
> (grob-interpret-markup grob
> (markup #:override '(baseline-skip . 0) #:number
> (#:line ((#:column (numOne denOne))
> (#:column (numTwo denTwo))))))
>
> It creates two columns from the four given arguments, but I want to be
> able to create an arbitrary number of columns.
>
> I see that #:line gets a list of (#:column ()) entries.
> But I'm lost with the #: part. What does that mean?
That's the markup macro. It is documented in the Extending Guide. More
or less.
> And how can I generate such a list with an arbitrary number of
> columns?
You can't actually do it in time since the whole point of a macro is
that it operates on its elements _before_ they are evaluated.
So the Extending Guide says:
Known issues and warnings
.........................
The markup-list argument of commands such as ‘#:line’, ‘#:center’, and
‘#:column’ cannot be a variable or the result of a function call.
(markup #:line (function-that-returns-markups))
is invalid. One should use the ‘make-line-markup’,
‘make-center-markup’, or ‘make-column-markup’ functions instead,
(markup (make-line-markup (function-that-returns-markups)))
So let's fiddle this in another way:
{
\once\override Staff.TimeSignature.stencil =
#(lambda (grob)
(grob-interpret-markup grob
(markup #:override '(baseline-skip . 0) #:number
(make-line-markup
(map (lambda (x)
(make-column-markup (map number->string x)))
'((3 8) (4 8) (5 8)))))))
\time 4/4 c1
}
Of course, we can just abandon hope regarding the markup macro and do
this as
{
\once\override Staff.TimeSignature.stencil =
#(lambda (grob)
(grob-interpret-markup grob
#{ \markup \override #'(baseline-skip . 0)
\number
#(map (lambda (x) #{ \markup \column #(map number->string x) #})
'((3 8) (4 8) (5 8)))
#}))
\time 4/4 c1
}
--
David Kastrup