lilypond-user
[Top][All Lists]
Advanced

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

Re: guile-question: 3/2 -> "1 1/2"


From: Thomas Morley
Subject: Re: guile-question: 3/2 -> "1 1/2"
Date: Tue, 11 Aug 2015 10:57:38 +0200

2015-08-11 8:19 GMT+02:00 David Kastrup <address@hidden>:
[...]
>
> Well, how about something like
>
> (define (integer-and-fraction nmbr)
>   (let* ((wh (truncate nmbr)) (rem (- nmbr wh)))
>     (if (or (zero? wh) (zero? rem)) (format #f "~s" nmbr)
>       (format #f "~s ~s" wh (abs rem)))))
>
> (display (integer-and-fraction (/ 1111 7)))
>
> Of course the disadvantage being that you cannot distinguish between one
> and two numbers and cannot read the number back in easily.
>
> --
> David Kastrup

Will have a closer look later, I'm in a hurry.

Many thanks,
  Harm



reply via email to

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