lilypond-user
[Top][All Lists]
Advanced

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

Re: Using strings and other types to return markup


From: Phil Holmes
Subject: Re: Using strings and other types to return markup
Date: Wed, 11 May 2016 10:54:26 +0100

Thanks both. I was sure I'd tried that as one of my variants, but clearly not. I think if I had tried it, I was incorrectly calling the procedure with a string without the # before it. FWIW I'd copied the syntax from the (markup (number->string newval))))) in http://lsr.di.unimi.it/LSR/Snippet?id=543 and Urs's explanation makes it clear that this is a function and so has (), whereas my attempt isn't, and so shouldn't.

--
Phil Holmes


----- Original Message ----- From: "Urs Liska" <address@hidden>
To: <address@hidden>
Sent: Wednesday, May 11, 2016 10:46 AM
Subject: Re: Using strings and other types to return markup




Am 11.05.2016 um 11:43 schrieb Jan-Peter Voigt:
Hi Phil,

you just need to remove the parens around 'theText'. Also inside
(markup ...) everything is interpreted as a parameter for the function
(macro or whatever) 'markup' and evaluated as a scheme-expression for
thet purpose.

To clarify that more:

(theText)

tries to invoke a procedure 'theText', while

theText

represents the variable as passed into the function as an argument.

HTH
Urs


HTH
Jan-Peter

#(define-markup-command (do-tilde layout props theText) (string?)
  (interpret-markup layout props
        (markup theText )
))


Am 11.05.2016 um 11:31 schrieb Phil Holmes:
I'm not top posting

I want to create a function in scheme that will take a string argument
something like "san~t" and return a markup which will place the tilde
above the n.  I know how to create the markup using markup functions
like
combine and translate, but I want to make this easier by using a scheme
function.  I'm struggling to work out how to take a string argument and
use it to return markup.  My test function is:

#(define-markup-command (do-tilde layout props theText) (string?)
   (interpret-markup layout props
         (markup (theText) )
))

I call it with:

mel = \relative c'' { c4  }
lyr = \lyricmode { \markup { \do-tilde #"Testing" } }
<<
\new Voice = melody \mel
\new Lyrics \lyricsto melody \lyr


I get the error

In expression (theText):
LyricTest.ly:13:17: Wrong type to apply: "Testing"

Can anyone point out to me what I'm doing wrong (or how to do this
correctly?)

TIA


_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user



_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user


_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user





reply via email to

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