]> gitweb.factorcode.org Git - factor.git/commitdiff
Spread now infers with the correct stack effect. Make spread>quot-shallow which trims...
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 2 Oct 2011 02:24:14 +0000 (19:24 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Mon, 3 Oct 2011 01:35:01 +0000 (18:35 -0700)
basis/fry/fry.factor
core/classes/tuple/tuple.factor
core/combinators/combinators-tests.factor
core/combinators/combinators.factor

index bf69f440bdf6bf4ec73738f2961688346d50e069..a262548214ceb8b55aebf1a3ea086f9f997b6bdd 100644 (file)
@@ -95,7 +95,7 @@ INSTANCE: fried-callable fried
     check-fry mark-composes
     { _ } split convert-curries
     [ [ [ ] ] [ [ ] (make-curry) but-last ] if-zero ]
-    [ spread>quot swap [ [ ] (make-curry) compose ] unless-zero ] if-empty ;
+    [ spread>quot-shallow swap [ [ ] (make-curry) compose ] unless-zero ] if-empty ;
 
 DEFER: dredge-fry
 
index 3c40efc2d35d7f63cf3b6199160d07e440b7b3c8..51faf3a550c8821a69eb21b1564fc86d189e08fc 100644 (file)
@@ -134,7 +134,7 @@ M: class final-class? drop t ;
     superclasses [ "slots" word-prop length ] map-sum ;
 
 : boa-check-quot ( class -- quot )
-    all-slots [ class>> instance-check-quot ] map spread>quot
+    all-slots [ class>> instance-check-quot ] map spread>quot-shallow
     f like ;
 
 : define-boa-check ( class -- )
index 97de07d54668a51e8631c0a8f5c233ef1b3fe791..1f524520b890fb1bcc856e48dbb02a1fe24160b5 100644 (file)
@@ -1,6 +1,6 @@
 USING: alien strings kernel math tools.test io prettyprint
 namespaces combinators words classes sequences accessors
-math.functions arrays combinators.private ;
+math.functions arrays combinators.private stack-checker ;
 IN: combinators.tests
 
 [ 3 ] [ 1 2 [ + ] call( x y -- z ) ] unit-test
@@ -320,3 +320,7 @@ DEFER: corner-case-1
 
 [ "nachos" ] [ 33 test-case-12 ] unit-test
 [ "nachos" ] [ 33 \ test-case-12 def>> call ] unit-test
+
+[ (( x x -- x x )) ] [
+    [ { [ ] [ ] } spread ] infer
+] unit-test
index fc259afbaf57ffd0ac5d53bb17f62317096da5ec..0453b257661aa6981f01bfc0c2805a8b2bc66515 100644 (file)
@@ -65,9 +65,12 @@ SLOT: terminated?
     [ [ 3keep ] curry ] map concat [ 3drop ] append [ ] like ;
 
 ! spread
-: spread>quot ( seq -- quot )
+: spread>quot-shallow ( seq -- quot )
     [ ] [ [ dup empty? [ [ dip ] curry ] unless ] dip append ] reduce ;
 
+: spread>quot ( seq -- quot )
+    [ ] [ [ [ dip ] curry ] dip append ] reduce ;
+
 : spread ( objs... seq -- )
     spread>quot call ;