when-negative ( ..a n quot: ( ..a n -- ..b ) -- ..b )


Vocabulary
math.combinators

Inputs
na real
quotthe first quotation of an if-negative


Outputs
None

Word description
When n is negative, calls the quotation with n.

Examples
USING: math math.combinators prettyprint ; -3 [ 1 + ] when-negative .
-2

USING: math math.combinators prettyprint ; 3.5 [ 1 + ] when-negative .
3.5


Definition

: when-negative ( ..a n quot: ( ..a n -- ..b ) -- ..b )
[ ] if-negative ; inline