VocabularymonadicsInputs| x | an object |
| left | a fallback value |
| pred | a quotation of type ( x -- bool ) |
OutputsWord descriptionCalls
pred on
x and either raises the original value to a
Right or replaces it with the fallback value as a
Left.
ExamplesUSING: math monadics prettyprint ;
90125 "Not a number." [ number? ] ?either .
T{ Right { value 90125 } }
USING: math monadics prettyprint ;
"Hello!" "Not a number." [ number? ] ?either .
T{ Left { value "Not a number." } }
Definition