combinators.smart: Make map-reduce-outputs a macro. To be a combinator, we need a full stack-checker rewrite.
parent
c4bd4dc1cc
commit
ebb722bf56
|
@ -81,7 +81,7 @@ IN: combinators.smart.tests
|
|||
|
||||
:: map-reduce-test ( a b c -- d ) [ a b c ] [ a - ] [ b * + ] map-reduce-outputs ;
|
||||
|
||||
[ ] [ 1 2 3 map-reduce-test ] unit-test
|
||||
[ 10 ] [ 1 2 3 map-reduce-test ] unit-test
|
||||
|
||||
[ ( x x -- x ) ] [ [ curry inputs ] infer ] unit-test
|
||||
|
||||
|
|
|
@ -81,8 +81,8 @@ M: object infer-known* drop f ;
|
|||
: map-outputs ( quot mapper -- )
|
||||
[ drop call ] [ swap outputs ] 2bi napply ; inline
|
||||
|
||||
: map-reduce-outputs ( quot mapper reducer -- )
|
||||
[ '[ _ _ map-outputs ] ] dip reduce-outputs ; inline
|
||||
MACRO: map-reduce-outputs ( quot mapper reducer -- quot )
|
||||
[ '[ _ _ map-outputs ] ] dip '[ _ _ reduce-outputs ] ;
|
||||
|
||||
: append-outputs-as ( quot exemplar -- seq )
|
||||
[ [ call ] [ outputs ] bi ] dip nappend-as ; inline
|
||||
|
|
Loading…
Reference in New Issue