sequences: fix map-reduce to have ..a on the stack for the first call.

factor-shell
John Benediktsson 2017-10-23 18:01:15 -07:00
parent c6953d5d62
commit 26b7b20622
1 changed files with 2 additions and 4 deletions

View File

@ -1001,12 +1001,10 @@ PRIVATE>
[ rest-slice ] [ first-unsafe ] bi ; inline
: map-reduce ( ..a seq map-quot: ( ..a elt -- ..b intermediate ) reduce-quot: ( ..b prev intermediate -- ..a next ) -- ..a result )
[ [ dup first ] dip [ call ] keep ] dip compose
swapd 1 each-from ; inline
[ [ [ first ] keep ] dip [ dip ] keep ] dip compose 1 each-from ; inline
: 2map-reduce ( ..a seq1 seq2 map-quot: ( ..a elt1 elt2 -- ..b intermediate ) reduce-quot: ( ..b prev intermediate -- ..a next ) -- ..a result )
[ [ 2dup [ first ] bi@ ] dip [ call ] keep ] dip compose
[ -rot ] dip 1 2each-from ; inline
[ [ [ [ first ] bi@ ] 2keep ] dip [ 2dip ] keep ] dip compose 1 2each-from ; inline
<PRIVATE