lilypond-user
[Top][All Lists]
Advanced

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

Re: scheme function


From: Gianmaria Lari
Subject: Re: scheme function
Date: Thu, 20 Dec 2018 13:58:47 +0100




On Thu, 20 Dec 2018 at 13:35, David Kastrup <address@hidden> wrote:
Gianmaria Lari <address@hidden> writes:

>> Uh, there is a difference between \markup and \mark .
>
>
> I put \mark just to make things more interesting.....  I'm joking.
> Shit!!!!! I made the usual stupid mistake that's perfect to complicate
> things :(
>
>
>> Once you fixed
>> that, your counter will be reset to 0 for each invocation of the
>> function.  You need
>>
>> nextcount =
>>   #(let ((counter 0))
>>      (define-scheme-function ...
>>
>
> Uhm.... I tried changing it like this:
>
> \version "2.19.82"
> nextcount =
>   #(let  ((counter 0))
>     (define-scheme-function () ()
>      (lambda ()
>        (set! counter (1+ counter))
>        (number->string counter)
>        )
>      ))
>
> \markup \nextcount
> \markup \nextcount
>
>
> but it doesn't compile....

That is because your scheme function does not return a string but rather
a lambda function that could be called for returning a string.

Remove the "(lambda ()" line and the corresponding ")".

It works :))))

 Thank you. Now I tried to play with them, understand them and the difference between them.

Thank you David.
g.

reply via email to

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