]> gitweb.factorcode.org Git - factor.git/commitdiff
minor inference and interpreter work
authorSlava Pestov <slava@factorcode.org>
Mon, 22 Nov 2004 00:27:18 +0000 (00:27 +0000)
committerSlava Pestov <slava@factorcode.org>
Mon, 22 Nov 2004 00:27:18 +0000 (00:27 +0000)
TODO.FACTOR.txt
library/test/inference.factor
library/test/interpreter.factor
library/tools/interpreter.factor

index 3d972a7acb9091760507b5573d179e7ff5920bc7..4abb15eaad9866febd526b263ab5242973007b38 100644 (file)
@@ -1,10 +1,7 @@
 + inference/interpreter:\r
 \r
-- : bin 5 [ 5 bin bin 5 ] [ 2drop ] ifte ;\r
 - combinator inference\r
-- generic/2generic inference\r
 - type inference\r
-- [ 2 2 . ] run fails\r
 - some way to step over a word in the stepper\r
 - step: print NEXT word to execute, not word that JUST executed\r
 - cache stack effects\r
index c18df6452194d974a046d24dbbc2fb85e4d4f070..004a02160ba82e4bf082bf479f2aa4195ee043f8 100644 (file)
@@ -125,6 +125,10 @@ DEFER: foe
         2drop f
     ] ifte ;
 
+! This form should not have a stack effect
+: bad-bin 5 [ 5 bad-bin bad-bin 5 ] [ 2drop ] ifte ;
+[ [ bad-bin ] infer ] unit-test-fails
+
 [ [ 2 | 1 ] ] [ [ fie ] infer ] unit-test
 [ [ 2 | 1 ] ] [ [ foe ] infer ] unit-test
 
@@ -139,6 +143,12 @@ DEFER: foe
 ! [ [ 1 | 1 ] ] [ [ last ] infer ] unit-test
 ! [ [ 1 | 1 ] ] [ [ list? ] infer ] unit-test
 
+[ [ 1 | 1 ] ] [ [ length ] infer ] unit-test
+[ [ 1 | 1 ] ] [ [ reverse ] infer ] unit-test
+[ [ 2 | 1 ] ] [ [ contains? ] infer ] unit-test
+[ [ 2 | 1 ] ] [ [ contains? ] infer ] unit-test
+[ [ 2 | 1 ] ] [ [ remove ] infer ] unit-test
+
 [ [ 2 | 1 ] ] [ [ bitor ] infer ] unit-test
 [ [ 2 | 1 ] ] [ [ bitand ] infer ] unit-test
 [ [ 2 | 1 ] ] [ [ bitxor ] infer ] unit-test
index 9de46bbc6b9858f77c50a770c872b4fc39d818c2..27cf4db24ba2822ab57d9c37663df326ffcd26b9 100644 (file)
@@ -4,6 +4,8 @@ USE: test
 USE: namespaces
 USE: combinators
 USE: stack
+USE: stdio
+USE: prettyprint
 USE: math
 USE: lists
 USE: kernel
@@ -47,3 +49,7 @@ USE: kernel
 [ { 4 } ] [
     init-interpreter [ 2 2 + ] run meta-d get
 ] unit-test
+
+[ { "4\n" } ] [
+    init-interpreter [ [ 2 2 + . ] with-string ] run meta-d get
+] unit-test
index 75e4fb0795ffc709dc1e9f71f738fe759c027e80..7f3566ad0bae4db5701cf92043c1edb715463b23 100644 (file)
@@ -60,7 +60,7 @@ SYMBOL: meta-cf
 : init-interpreter ( -- )
     10 <vector> meta-r set
     10 <vector> meta-d set
-    f meta-n set
+    namestack meta-n set
     f meta-c set
     f meta-cf set ;