View Source Document

sign.robin

;'<<SPEC'

### `sign` ###

    -> Tests for functionality "Evaluate Robin Expression (with literal)"

`sign` evaluates its sole argument to a number, then
evaluates to 0 if that number is 0, 1 if that number is positive, or
-1 if that number is negative.

    | (sign 26)
    = 1

    | (sign 0)
    = 0

    | (sign (subtract 0 200))
    = -1

`sign` expects a number.

    | (sign #f)
    ? abort (expected-number #f)

    | (sign (literal k))
    ? abort (expected-number k)

`sign` expects exactly one argument.

    | (sign 100 200 300)
    ? abort (illegal-arguments (100 200 300))

    | (sign)
    ? abort (illegal-arguments ())

'<<SPEC'

(require sign)