combinators.short-circuit: speed up in non-optimized code
parent
343151fd62
commit
60f4f4c16e
|
@ -12,10 +12,10 @@ MACRO:: n&& ( quots n -- quot )
|
|||
n '[ _ nnip ] suffix 1array
|
||||
[ cond ] 3append ;
|
||||
|
||||
MACRO: 0&& ( quots -- quot ) '[ _ 0 n&& ] ;
|
||||
MACRO: 1&& ( quots -- quot ) '[ _ 1 n&& ] ;
|
||||
MACRO: 2&& ( quots -- quot ) '[ _ 2 n&& ] ;
|
||||
MACRO: 3&& ( quots -- quot ) '[ _ 3 n&& ] ;
|
||||
: 0&& ( quots -- ? ) [ call ] all? ;
|
||||
: 1&& ( obj quots -- ? ) [ call ] with all? ;
|
||||
: 2&& ( obj quots -- ? ) [ call ] with with all? ;
|
||||
: 3&& ( obj quots -- ? ) [ call ] with with with all? ;
|
||||
|
||||
MACRO:: n|| ( quots n -- quot )
|
||||
[ f ] quots [| q |
|
||||
|
@ -27,7 +27,8 @@ MACRO:: n|| ( quots n -- quot )
|
|||
n '[ drop _ ndrop t ] [ f ] 2array suffix 1array
|
||||
[ cond ] 3append ;
|
||||
|
||||
MACRO: 0|| ( quots -- quot ) '[ _ 0 n|| ] ;
|
||||
MACRO: 1|| ( quots -- quot ) '[ _ 1 n|| ] ;
|
||||
MACRO: 2|| ( quots -- quot ) '[ _ 2 n|| ] ;
|
||||
MACRO: 3|| ( quots -- quot ) '[ _ 3 n|| ] ;
|
||||
: 0|| ( quots -- ? ) [ call ] any? ;
|
||||
: 1|| ( obj quots -- ? ) [ call ] with any? ;
|
||||
: 2|| ( obj quots -- ? ) [ call ] with with any? ;
|
||||
: 3|| ( obj quots -- ? ) [ call ] with with with any? ;
|
||||
|
||||
|
|
|
@ -83,6 +83,38 @@ IN: stack-checker.transforms
|
|||
|
||||
\ spread t "no-compile" set-word-prop
|
||||
|
||||
\ 0&& [ '[ _ 0 n&& ] ] 1 define-transform
|
||||
|
||||
\ 0&& t "no-compile" set-word-prop
|
||||
|
||||
\ 1&& [ '[ _ 1 n&& ] ] 1 define-transform
|
||||
|
||||
\ 1&& t "no-compile" set-word-prop
|
||||
|
||||
\ 2&& [ '[ _ 2 n&& ] ] 1 define-transform
|
||||
|
||||
\ 2&& t "no-compile" set-word-prop
|
||||
|
||||
\ 3&& [ '[ _ 3 n&& ] ] 1 define-transform
|
||||
|
||||
\ 3&& t "no-compile" set-word-prop
|
||||
|
||||
\ 0|| [ '[ _ 0 n|| ] ] 1 define-transform
|
||||
|
||||
\ 0|| t "no-compile" set-word-prop
|
||||
|
||||
\ 1|| [ '[ _ 1 n|| ] ] 1 define-transform
|
||||
|
||||
\ 1|| t "no-compile" set-word-prop
|
||||
|
||||
\ 2|| [ '[ _ 2 n|| ] ] 1 define-transform
|
||||
|
||||
\ 2|| t "no-compile" set-word-prop
|
||||
|
||||
\ 3|| [ '[ _ 3 n|| ] ] 1 define-transform
|
||||
|
||||
\ 3|| t "no-compile" set-word-prop
|
||||
|
||||
\ (call-next-method) [
|
||||
[
|
||||
[ "method-class" word-prop ]
|
||||
|
|
Loading…
Reference in New Issue