Hi Simon,

It's the signum function sgn of course, implemented in racket as sgn, but
not in guile or the SRFI's with guile AFAIK.

You could also say in Scheme:

(define (sgn n)
  (cond ((negative? n) -1)
        ((positive? n)  1)
        (else 0)))

A dozen ways to implement, of course, Would be worth having this function
somewhere in the lily libraries.

Andrew



On 17 April 2017 at 21:06, Simon Albrecht <simon.albre...@mail.de> wrote:

> Am 16.04.2017 um 19:29 schrieb Thomas Morley:
>
>> #(define (sign x)
>>    (if (= x 0)
>>        0
>>        (if (< x 0) -1 1)))
>>
>
> I can hardly imagine that default guile or any SRFI doesn’t already
> provide such a function – unfortunately I’m not well-versed enough to know…
> Anyone?
>
>
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to