diff dict.rhope @ 99:e09c2d1d6d5b

Got dataflow graph code working in compiler (nworker_c.rhope)
author Mike Pavone <pavone@retrodev.com>
date Fri, 06 Aug 2010 01:42:37 -0400
parents fa437d23bb24
children c9974ac32369
line wrap: on
line diff
--- a/dict.rhope	Tue Aug 03 23:51:39 2010 -0400
+++ b/dict.rhope	Fri Aug 06 01:42:37 2010 -0400
@@ -46,7 +46,12 @@
 
 _Set@Empty Dictionary[dict,index,val,bits,bitindex:out]
 {
-	out <- _Set New[index,val,bits,bitindex]
+	If[[bits]=[0u32]]
+	{
+		out <- _Terminal Node[val]
+	}{
+		out <- _Set New[index,val,bits,bitindex]
+	}
 }
 
 Set@Empty Dictionary[dict,index,val:out]
@@ -67,13 +72,14 @@
 
 Index@Dictionary[dict,index:out,not found]
 {
+	
 	out,not found <- [dict]_Index[index,[Dict Type ID[index]]+[1u32], -1]
 }
 
 _Index@Dictionary[dict,index,bits,bitindex:out,not found]
 {
 	If[[bits]=[[dict]Bits >>]]
-	{
+	{	
 		If[[bits]=[0u32]]
 		{
 			out <- Straight >>[dict]
@@ -238,6 +244,21 @@
 	}
 }
 
+_String Seq[str,val,key:out]
+{
+	out <- [[[[str
+		]Append["\n\t"]
+		]Append[String[key]]
+		]Append[":\t"]
+		]Append[String[val]]
+}
+
+
+String@Dictionary[dict:out]
+{
+	out <- Fold[_String Seq[?], "Dictionary", dict]
+}
+
 _Print Seq[dict,key:out]
 {
 	val <- String[[dict]Index[key]]