unless ( ..a ? false: ( ..a -- ..a ) -- ..a ) (original) (raw)

Vocabulary
kernel

Inputs

? a generalized boolean
false a quotation

Outputs
None

Word description
If cond is f, calls the false quotation.

The cond value is removed from the stack before the quotation is called.

Examples

USING: kernel math prettyprint sequences ; IN: scratchpad CONSTANT: american-cities { "San Francisco" "Los Angeles" "New York" } : add-tax ( price city -- price' ) american-cities member? [ 1.1 * ] unless ; 123 "Ottawa" add-tax .
135.3

Definition

IN: kernel

: unless ( ..a ? false: ( ..a -- ..a ) -- ..a ) [ ] swap if
; inline