Paste: reduce+ again
Author: | randy |
Mode: | factor |
Date: | Sun, 10 May 2009 20:19:05 |
Plain Text |
: reduce+ ( obj items-seq quot: ( obj item -- obj ) -- obj )
over empty?
[ 2drop ]
[ dup [ unclip swap ] 2dip swapd [ call ] 2dip
reduce+ ] if ; inline
Author: | rand |
Mode: | factor |
Date: | Sun, 10 May 2009 20:26:51 |
Plain Text |
: reduce+ ( obj items-seq quot: ( obj item -- obj ) -- obj )
over empty?
[ 2drop ]
[ [ unclip swap ] dip tuck 2slip
reduce+ ] if ; inline
Author: | r |
Mode: | factor |
Date: | Tue, 12 May 2009 20:54:14 |
Plain Text |
: reduce+ ( obj items-seq quot: ( obj item -- obj ) -- obj )
over empty?
[ 2drop ]
[ [ [ first ] [ rest ] bi ] dip tuck 2slip
reduce+ ] if ; inline
Author: | randy |
Mode: | factor |
Date: | Tue, 12 May 2009 21:09:55 |
Plain Text |
: reduce+ ( obj items quot -- obj' )
'[ _ curry ] map (reduce+) drop ;
: (reduce+) ( obj quot-items -- obj' quot-items )
dup empty? [ unclip swap [ call ] dip (reduce+) ] unless ; recursive
Author: | k |
Mode: | factor |
Date: | Tue, 12 May 2009 21:22:49 |
Plain Text |
: (reduce+) ( obj quot-items -- obj' quot-items )
dup empty? [ unclip swap [ call ] dip (reduce+) ] unless ; inline recursive
: reduce+ ( obj items quot -- obj' )
'[ _ curry ] map (reduce+) drop ; inline
New Annotation