diff --git a/basis/combinators/short-circuit/smart/smart.factor b/basis/combinators/short-circuit/smart/smart.factor index 141077ea3a..ca659cacbe 100644 --- a/basis/combinators/short-circuit/smart/smart.factor +++ b/basis/combinators/short-circuit/smart/smart.factor @@ -1,11 +1,18 @@ -USING: kernel sequences math stack-checker accessors macros +USING: kernel sequences math stack-checker effects accessors macros combinators.short-circuit ; IN: combinators.short-circuit.smart -MACRO: && ( quots -- quot ) - dup first infer [ in>> ] [ out>> ] bi - 1+ n&&-rewrite ; +> ] [ out>> ] bi - 1+ n||-rewrite ; +: arity ( quots -- n ) + first infer + dup terminated?>> [ "Cannot determine arity" throw ] when + effect-height neg 1+ ; + +PRIVATE> + +MACRO: && ( quots -- quot ) dup arity n&&-rewrite ; + +MACRO: || ( quots -- quot ) dup arity n||-rewrite ;