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