lilypond-user
[Top][All Lists]
Advanced

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

Re: help with Wrong type of argument


From: Michael Werner
Subject: Re: help with Wrong type of argument
Date: Mon, 1 May 2023 02:20:13 -0400

Hi Jeff,

To say I'm no expert in Scheme is a vast understatement. However, I think I found the answer to this one. Or, at least, something that seems to make this code work for me here.

On Mon, May 1, 2023 at 1:00 AM Jeff Olson <jjocanoe@gmail.com> wrote:
%< snip >% 
Here's my code (small if not minimal):

\version "2.24.0"

#(define-markup-command (dopath layout props xtip ytip hgt wid txt rot)
   (number? number? number? number? string? number?)
   (let (
          (a (* wid 0.4))
          )
   (interpret-markup layout props
     #{\markup \translate #(cons xtip ytip) \rotate #rot \path #0.25

 Basically, as I understand things, this bit:
 
       #'((lineto 0 hgt)

Accosrding to my rather vague understanding of Scheme syntax the ' between the # and the 1st ( is saying don't interpret anything in that _expression_, just pass it as is. Which means that your variable hgt isn't getting passed as a variable but is getting passed as simply a series of three characters. What seems to be needed (and what made this appear to work here) is to use what's called quasiquoting. Basically, it lets you designate certain bits within an _expression_ as "this part should be interpreted before getting passed on". This entails changing the above line to:

#`((lineto 0 ,hgt)

By changing the ' into a ` (BTW, that's the one that on my keyboard is up near the top left, just under the Escape key) you say that there's something in the following _expression_ that will need interpreted. Then the comma before the variable name points out which item to interpret. There's a great deal more to all this, but this is the bare basics as I sorta kinda vaguely understand them. All the gory details can be found at:

https://extending-lilypond.gitlab.io/en/scheme/quoting.html
 
          (closepath))
       #})))

\markup \dopath #10 #0 #2 #1 "D" #-5

Hope this helped at least a little. Or at least didn't confuse things worse.

Michael 

reply via email to

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