combinators.smart: Make map-reduce-outputs a macro. To be a combinator, we need a full stack-checker rewrite.

db4
Doug Coleman 2011-12-19 11:12:37 -08:00
parent c4bd4dc1cc
commit ebb722bf56
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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