2013/9/18 David Kastrup <[email protected]>:
> Janek Warchoł <[email protected]> writes:
>
>> 2013/9/18 David Kastrup <[email protected]>:
>>> Janek Warchoł <[email protected]> writes:
>>>> Now, i would like to be able to supply a decimal number and have it
>>>> converted to a rational number (i.e. a fraction, which can be easily
>>>> converted to a moment)
>>>
>>> How did you search?  It's right in the GUILE manual where one would
>>> expect, with rational numbers.
>>
>> I've grepped through LilyPond sources for various keywords, and looked
>> around definitions of other conversions.
>> I guess i should add guile manual to my RTFM list.
>>
>> In the meantime, i have trouble with converting from a fraction to a
>> moment - this returns an error:
>>
>> \version "2.16.2"
>>
>> foof =
>> #(define-music-function (parser location) ()
>>    #{
>>      \override Score.SpacingSpanner.common-shortest-duration =
>>      #(fraction->moment (1 32))
>>    #})
>
> (1 32) tries to call 1 with 32 as its argument.  Just write
>
> #(ly:make-moment 1/32)
>
> and be done.  If you really, really don't remember how LilyPond
> represents fractions and you really, really want to use
> fraction->moment, you can write
>
> #(fraction->moment #{ 1/32 #})

Also possible:
#(fraction->moment (cons 1 32))

Cheers,
  Harm
>
>> i'm probably doing something stupid here...
>
> Depends on your level of Scheme knowledge.
>
> --
> David Kastrup
>
> _______________________________________________
> lilypond-user mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/lilypond-user

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to