]> gitweb.factorcode.org Git - factor.git/blob - basis/combinators/short-circuit/smart/smart.factor
7264a07917a1867fd933efc750f96ec5240741f5
[factor.git] / basis / combinators / short-circuit / smart / smart.factor
1 USING: kernel sequences math stack-checker effects accessors
2 macros fry combinators.short-circuit ;
3 IN: combinators.short-circuit.smart
4
5 <PRIVATE
6
7 ERROR: cannot-determine-arity ;
8
9 : arity ( quots -- n )
10     first infer
11     dup terminated?>> [ cannot-determine-arity ] when
12     effect-height neg 1 + ;
13
14 PRIVATE>
15
16 MACRO: && ( quots -- quot ) dup arity '[ _ _ n&& ] ;
17
18 MACRO: || ( quots -- quot ) dup arity '[ _ _ n|| ] ;