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

19 lines
419 B
Factor
Raw Normal View History

USING: kernel sequences math stack-checker effects accessors
macros 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
ERROR: cannot-determine-arity ;
2008-08-26 21:40:19 -04:00
: arity ( quots -- n )
first infer
dup terminated?>> [ cannot-determine-arity ] when
effect-height neg 1 + ;
2008-08-26 21:40:19 -04:00
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|| ] ;