diff list.rhope @ 76:004f0fc8941f

Fix list implementation
author Mike Pavone <pavone@retrodev.com>
date Wed, 07 Jul 2010 00:36:59 -0400
parents 0083b2f7b3c7
children e73a93fb5de1
line wrap: on
line diff
--- a/list.rhope	Tue Jul 06 07:52:59 2010 -0400
+++ b/list.rhope	Wed Jul 07 00:36:59 2010 -0400
@@ -86,7 +86,6 @@
 
 First@List Leaf[list:out,none]
 {
-	Print["First@List Leaf"]
 	[[list]Buffer >>]Index[0]
 	{ out <- 0 }
 	{ none <- Yes }
@@ -94,15 +93,11 @@
 
 Next@List Leaf[list,index:next,none]
 {
-	Print["Next@List Leaf"]
-	{ Print[index]
-	{
 	pos next <- [index]+[1]
 	,none <- If[[pos next] < [[list]Length]]
 	{
 		next <- Val[pos next]
 	}
-	}}
 }
 
 Blueprint List
@@ -182,7 +177,6 @@
 							]Length <<[ [[list]Length >>]+[1] ]
 							]Right Offset <<[nroffset]
 					}{
-						
 						out <- [[[list]Right <<[ [[list]Right >>]Set[0, val] ]
 							]Right Offset <<[index]
 							]Length <<[ [[list]Length >>]+[1] ]
@@ -230,7 +224,7 @@
 	{
 		out <- [list]Set[index, val]
 	}{
-		out,did'nt set <- [list]_Right Set[[index]-[[list]Right Offset >>], val]
+		out,didn't set <- [[list]Right >>]_Right Set[[index]-[[list]Right Offset >>], val]
 	}
 }
 
@@ -251,7 +245,6 @@
 
 First@List[list:out,none]
 {
-	Print["First@List"]
 	If[[[list]Left >>]Length]
 	{
 		out <- [[list]Left >>]First
@@ -262,38 +255,25 @@
 
 Next@List[list,index:next,none]
 {
-	Print["Next@List"]
-	{ Print[index]
-	{ Print[[list]Offset >>]
-	{
 	If[[index] < [[[list]Offset >>]-[1]]]
 	{
-		Print["Left"]
 		next <- [[list]Left >>]Next[index] {}
 		{ next <- Offset >>[list] }
 	}{
 		If[[index] < [[list]Right Offset >>]]
 		{
-			Print["Middle"]
 			pos next <- [index]+[1]
 			If[[pos next] < [[[[list]Buffer >>]Length >>]+[[list]Offset >>]]]
 			{
 				next <- Val[pos next]
 			}{
-				Print["Middle done going Right instead"]
 				,none <- [[list]Right >>]First
 				{ next <- [~]+[[list]Right Offset >>] }
-				{
-					Print["First on right returned none"]
-					{ Print[[[list]Right >>]Length] }
-				}
 			}
 		}{
-			Print["right"]
 			,none <- [[list]Right >>]Next[[index]-[[list]Right Offset >>]]
 			{ next <- [~]+[[list]Right Offset >>] }
 		}
 	}
-	}}}
 }