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 ;
|
||||
|
||||
IN: combinators.short-circuit.smart
|
||||
|
||||
MACRO: && ( quots -- quot )
|
||||
dup first infer [ in>> ] [ out>> ] bi - 1+ n&&-rewrite ;
|
||||
<PRIVATE
|
||||
|
||||
MACRO: || ( quots -- quot )
|
||||
dup first infer [ in>> ] [ 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 ;
|
||||
|
|
Loading…
Reference in New Issue