2008-06-24 09:35:06 -04:00
|
|
|
|
2008-06-24 11:39:50 -04:00
|
|
|
USING: kernel combinators quotations arrays sequences assocs
|
2008-07-07 20:36:33 -04:00
|
|
|
locals generalizations macros fry ;
|
2008-06-24 09:35:06 -04:00
|
|
|
|
|
|
|
IN: combinators.short-circuit
|
|
|
|
|
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
2008-06-24 11:39:50 -04:00
|
|
|
:: n&&-rewrite ( quots N -- quot )
|
|
|
|
quots
|
|
|
|
[ '[ drop N ndup @ dup not ] [ drop N ndrop f ] 2array ]
|
|
|
|
map
|
|
|
|
[ t ] [ N nnip ] 2array suffix
|
2008-09-10 23:11:40 -04:00
|
|
|
'[ f _ cond ] ;
|
2008-06-24 09:35:06 -04:00
|
|
|
|
2008-06-24 11:39:50 -04:00
|
|
|
MACRO: 0&& ( quots -- quot ) 0 n&&-rewrite ;
|
|
|
|
MACRO: 1&& ( quots -- quot ) 1 n&&-rewrite ;
|
|
|
|
MACRO: 2&& ( quots -- quot ) 2 n&&-rewrite ;
|
2008-07-04 00:14:42 -04:00
|
|
|
MACRO: 3&& ( quots -- quot ) 3 n&&-rewrite ;
|
2008-06-24 09:35:06 -04:00
|
|
|
|
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
2008-06-24 11:39:50 -04:00
|
|
|
:: n||-rewrite ( quots N -- quot )
|
|
|
|
quots
|
|
|
|
[ '[ drop N ndup @ dup ] [ N nnip ] 2array ]
|
|
|
|
map
|
|
|
|
[ drop N ndrop t ] [ f ] 2array suffix
|
2008-09-10 23:11:40 -04:00
|
|
|
'[ f _ cond ] ;
|
2008-06-24 09:35:06 -04:00
|
|
|
|
2008-06-24 11:39:50 -04:00
|
|
|
MACRO: 0|| ( quots -- quot ) 0 n||-rewrite ;
|
|
|
|
MACRO: 1|| ( quots -- quot ) 1 n||-rewrite ;
|
|
|
|
MACRO: 2|| ( quots -- quot ) 2 n||-rewrite ;
|
2008-07-04 00:14:42 -04:00
|
|
|
MACRO: 3|| ( quots -- quot ) 3 n||-rewrite ;
|
2008-06-24 09:35:06 -04:00
|
|
|
|
2008-06-24 11:39:50 -04:00
|
|
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|