factor/basis/combinators/short-circuit/smart/smart.factor

17 lines
393 B
Factor
Raw Normal View History

2008-08-26 21:40:19 -04:00
USING: kernel sequences math stack-checker effects accessors macros
2008-11-21 05:36:18 -05:00
fry combinators.short-circuit ;
2008-06-24 11:40:55 -04:00
IN: combinators.short-circuit.smart
2008-08-26 21:40:19 -04:00
<PRIVATE
2008-06-24 11:40:55 -04:00
2008-08-26 21:40:19 -04:00
: arity ( quots -- n )
first infer
dup terminated?>> [ "Cannot determine arity" throw ] when
effect-height neg 1+ ;
PRIVATE>
2008-11-21 05:36:18 -05:00
MACRO: && ( quots -- quot ) dup arity '[ _ _ n&& ] ;
2008-08-26 21:40:19 -04:00
2008-11-21 05:36:18 -05:00
MACRO: || ( quots -- quot ) dup arity '[ _ _ n|| ] ;