spread>quot now outputs empty quotations where you would expect so that things like { [ ] [ ] } spread infer as ( x x -- x x ) instead of ( -- )

Fixes #139
db4
Doug Coleman 2011-09-18 23:23:53 -05:00
parent bf2a96e9e0
commit 15f44a7276
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
USING: alien strings kernel math tools.test io prettyprint USING: alien strings kernel math tools.test io prettyprint
namespaces combinators words classes sequences accessors namespaces combinators words classes sequences accessors
math.functions arrays combinators.private ; math.functions arrays combinators.private stack-checker ;
IN: combinators.tests IN: combinators.tests
[ 3 ] [ 1 2 [ + ] call( x y -- z ) ] unit-test [ 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 ] unit-test
[ "nachos" ] [ 33 \ test-case-12 def>> call ] unit-test [ "nachos" ] [ 33 \ test-case-12 def>> call ] unit-test
! Fixes #138
[ { 3 3 } ]
[ [ { [ ] [ ] [ ] } spread ] [ inputs ] [ outputs ] bi 2array ] unit-test

View File

@ -66,7 +66,7 @@ SLOT: terminated?
! spread ! spread
: spread>quot ( seq -- quot ) : spread>quot ( seq -- quot )
[ ] [ [ dup empty? [ [ dip ] curry ] unless ] dip append ] reduce ; [ ] [ [ [ dip ] curry ] dip append ] reduce ;
: spread ( objs... seq -- ) : spread ( objs... seq -- )
spread>quot call ; spread>quot call ;