changeset 76:004f0fc8941f

Fix list implementation
author Mike Pavone <pavone@retrodev.com>
date Wed, 07 Jul 2010 00:36:59 -0400
parents 0083b2f7b3c7
children a748300a4143
files functional.rhope list.rhope testlist.rhope
diffstat 3 files changed, 1 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/functional.rhope	Tue Jul 06 07:52:59 2010 -0400
+++ b/functional.rhope	Wed Jul 07 00:36:59 2010 -0400
@@ -1,9 +1,6 @@
 
 _Fold[list,index,current,worker:out]
 {
-	Print["_Fold"]
-	{ Print[index]
-	{
 	newval <- [worker]Call[current, [list]Index[index], index]
 	
 	[list]Next[index]
@@ -12,18 +9,14 @@
 	}{
 		out <- Val[newval]
 	}
-	}}
 }
 
 Fold[worker,start,list:out]
 {
-	Print["Fold"]
 	[list]First
 	{
-		Print["Got first"]
 		out <- _Fold[list, ~, start, worker]
 	}{
-		Print["no first"]
 		out <- start
 	}
 }
--- 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 >>] }
 		}
 	}
-	}}}
 }
 
--- a/testlist.rhope	Tue Jul 06 07:52:59 2010 -0400
+++ b/testlist.rhope	Wed Jul 07 00:36:59 2010 -0400
@@ -10,20 +10,12 @@
 
 Make List Step[list, cur index, curval, num, step:out]
 {
-	Print["Make List Step"]
-	{ Print[cur index]
-	{ Print[curval]
-	{
 	If[[curval]=[num]]
 	{ out <- list }
 	{
 		next <- [list]Set[cur index, curval]
-		Print[[next]Length]
-		{
 		out <- Make List Step[next, [cur index]+[step], [curval]+[1], num, step]
-		}
 	}
-	}}}
 }
 
 Sum[list,index,cur:out]