Hi Harm,
User specification of input only guessed at by me. :-) Of course, for negative and positive input (e.g. -3/2): (define (mixed-num x) (let* ((n (numerator x)) (d (denominator x))) (cons (truncate (/ n d)) (abs (/ (remainder n d) d))))) But are you saying you also need the function to take any number as input, not just a known fraction? Do you really want something like the rationalize function ? The common mathematical term for 3 1/2 is mixed number, or mixed fraction, by the way. Andrew On 12/08/2015 09:09, "Thomas Morley" <lilypond-user-bounces+andrew.bernard=gmail....@gnu.org on behalf of thomasmorle...@gmail.com> wrote: > >`mixed-num' can't deal with negative input right now, returning wrong >(could be fixed ofcourse). > >In case the input is not exact `mixed-num' crashes, whereas >`integer-and-fraction' doesn't, although returning not a fraction. _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user