Clean up smart && and ||
parent
efb5553950
commit
47cb866891
|
@ -1,11 +1,18 @@
|
||||||
|
|
||||||
USING: kernel sequences math stack-checker accessors macros
|
USING: kernel sequences math stack-checker effects accessors macros
|
||||||
combinators.short-circuit ;
|
combinators.short-circuit ;
|
||||||
|
|
||||||
IN: combinators.short-circuit.smart
|
IN: combinators.short-circuit.smart
|
||||||
|
|
||||||
MACRO: && ( quots -- quot )
|
<PRIVATE
|
||||||
dup first infer [ in>> ] [ out>> ] bi - 1+ n&&-rewrite ;
|
|
||||||
|
|
||||||
MACRO: || ( quots -- quot )
|
: arity ( quots -- n )
|
||||||
dup first infer [ in>> ] [ out>> ] bi - 1+ n||-rewrite ;
|
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 ;
|
||||||
|
|
Loading…
Reference in New Issue