]> gitweb.factorcode.org Git - factor.git/commitdiff
combinators.smart: Fix infer-known; should be 100% now.
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 29 Nov 2011 04:54:17 +0000 (20:54 -0800)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 29 Nov 2011 04:55:11 +0000 (20:55 -0800)
It's stack-checker bugs all the way down.

basis/combinators/smart/smart-tests.factor
basis/combinators/smart/smart.factor

index c7c11401c9a8c1c7dd29b32a9cc4264bf1153551..0a28c0ea83415d7b0dc1ca05ee2577ec4239f3e2 100644 (file)
@@ -82,3 +82,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
+
+[ ( x x -- x ) ] [ [ curry inputs ] infer ] unit-test
+
+[ ( x -- x ) ] [ [ [ curry ] curry inputs ] infer ] unit-test
index d36fc56557bf6641cb6eb80afb18a9bfce95af85..9742ca72a273be1b593395ab1ce08c13371178cb 100644 (file)
@@ -30,19 +30,22 @@ GENERIC: infer-known* ( known -- effect )
     ] if*
 ] "special" set-word-prop
 
-! TODO: Handle the case where a nested call to infer-known returns f
-
 M: curried infer-known*
-    quot>> infer-known curry-effect ;
+    quot>> infer-known dup [
+        curry-effect
+    ] [
+        drop f
+    ] if ;
 
 M: composed infer-known*
     [ quot1>> ] [ quot2>> ] bi
-    [ infer-known ] bi@ compose-effects ;
+    [ infer-known ] bi@
+    2dup and [ compose-effects ] [ 2drop f ] if ;
 
 M: declared-effect infer-known*
     known>> infer-known* ;
 
-M: input-parameter infer-known* \ inputs/outputs unknown-macro-input ;
+M: input-parameter infer-known* drop f ;
 
 M: object infer-known* drop f ;