On Thu, 20 Dec 2018 at 13:12, Gianmaria Lari <gianmarial...@gmail.com>
wrote:

>
>
> On Thu, 20 Dec 2018 at 13:10, Urs Liska <li...@openlilylib.org> wrote:
>
>>
>>
>> Am 20. Dezember 2018 13:02:22 MEZ schrieb David Kastrup <d...@gnu.org>:
>> >Gianmaria Lari <gianmarial...@gmail.com> writes:
>> >
>> >> %alternate version
>> >> \version "2.19.82"
>> >> nextcount =
>> >>   #(let  ((counter 0))
>> >>      (lambda ()
>> >>        (set! counter (1+ counter))
>> >>        (number->string counter)))
>> >>
>> >> \markup #(nextcount)
>> >> \markup #(nextcount)
>> >>
>> >>
>> >> I would like to know if it is possible to write it using
>> >> define-scheme-function. This is what I tried that does not compile.
>> >>
>> >> \version "2.19.82"
>> >> nextcount =
>> >>   #(define-scheme-function () ()
>> >>      (let  ((counter 0))
>> >>      (lambda ()
>> >>        (set! counter (1+ counter))
>> >>        (number->string counter)
>> >>        )
>> >>      ))
>> >>
>> >> \mark \nextcount
>> >> \mark \nextcount
>> >
>> >Uh, there is a difference between \markup and \mark .  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 ...
>> >
>> >instead.
>>
>> And it must be
>>
>>   (set! counter (+ 1 counter))
>>
>> (first the procedure "+", then the arguments)
>>
>
> I think 1+ is correct. David use it :)) (I hope I don't remember bad)
>

I mean, it's not only David: it works, I found it some documentation about
it and it looks (to me) the equivalent of increment operator ++ in c.
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to