]> gitweb.factorcode.org Git - factor.git/commitdiff
combinators.smart: Make map-reduce-outputs a macro. To be a combinator, we need a...
authorDoug Coleman <doug.coleman@gmail.com>
Mon, 19 Dec 2011 19:12:37 +0000 (11:12 -0800)
committerDoug Coleman <doug.coleman@gmail.com>
Mon, 19 Dec 2011 19:12:37 +0000 (11:12 -0800)
basis/combinators/smart/smart-tests.factor
basis/combinators/smart/smart.factor

index 0a28c0ea83415d7b0dc1ca05ee2577ec4239f3e2..36a1bd03d15b80855e643389ed0137b993d0822d 100644 (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
 
index bf88b2e6b25baecbded93433e58028fc721e09f4..da60bf984f1ef188e53fa759a180cd142a734086 100644 (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