lilypond-user
[Top][All Lists]
Advanced

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

Re: string->number scheme


From: David Kastrup
Subject: Re: string->number scheme
Date: Wed, 13 Nov 2013 14:56:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Stjepan Horvat <address@hidden> writes:

> Hi guys..
> I would want to make a simple function that would convert my string to
> number..wha?
>
> i have a a variable inside header that is called bpm. inside bpm is my
> tempo but in string.

Why?

> for example:
>
> \header {
>   bpm = "123"
> }
>
> {
> \tempo 4 = \bpm
> c'4
> }
>
> or in midi block
>
> \midi { \tempo 4 = \bpm }
>
> i had an idea of converting string to number using string->number..
> #(define bpm "123")
> #(define bpmInt (string->number bpm)

Missing closing paren, it would seem.

> but it didnt work nor
>
> bpmInt =
> #(define-music-function
>     (parser location bpm
>     (string?)
>     (string->number bpm)))

The body of define-music-function needs to return music, so you probably
would want define-scheme-function instead.

> any ideas.?

I have no idea why you don't just write

    bpm = 123

and that's that.  Why go through a string in the first place?

-- 
David Kastrup




reply via email to

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