Paste: my-binary-reduce
Author: | jwmerrill |
Mode: | factor |
Date: | Fri, 12 Dec 2008 06:10:15 |
Plain Text |
USING: kernel sequences locals ;
IN: my-sequences
:: (my-binary-reduce) ( seq quot -- val )
seq length 1 =
[ seq first ]
[ seq halves [ quot (my-binary-reduce) ] bi@ quot call ]
if ; inline recursive
: my-binary-reduce ( seq id quot -- val )
swapd [ (my-binary-reduce) ] keep call ; inline
Author: | jwmerrill |
Mode: | factor |
Date: | Fri, 12 Dec 2008 06:36:22 |
Plain Text |
USING: kernel sequences locals ;
IN: my-sequences
:: (my-binary-reduce) ( seq quot -- val )
seq length 1 =
[ seq first ]
[ seq halves [ quot (my-binary-reduce) ] bi@ quot call ]
if ; inline recursive
: my-binary-reduce ( seq id quot -- val )
swapd over length 0 =
[ 2drop ]
[ [ (my-binary-reduce) ] keep call ]
if ; inline
New Annotation