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

19 lines
396 B
Factor
Raw Normal View History

2008-06-24 11:40:55 -04:00
2008-08-26 21:40:19 -04:00
USING: kernel sequences math stack-checker effects accessors macros
2008-06-24 11:40:55 -04:00
combinators.short-circuit ;
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>
MACRO: && ( quots -- quot ) dup arity n&&-rewrite ;
MACRO: || ( quots -- quot ) dup arity n||-rewrite ;