changeset 130:147dfc703161

Add String method to List
author Mike Pavone <pavone@retrodev.com>
date Fri, 05 Nov 2010 02:42:45 +0000
parents c9974ac32369
children 0a4682be2db2
files list.rhope
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/list.rhope	Fri Nov 05 02:42:18 2010 +0000
+++ b/list.rhope	Fri Nov 05 02:42:45 2010 +0000
@@ -326,6 +326,26 @@
 	}	
 }
 
+_String Seq[text,val,key:out]
+{
+	out <- [text]Append[ [[["\n\t"]Append[String[key]]]Append[":\t"]]Append[ [[String[val]]Split["\n"]]Join["\t\n"] ] ]
+}
+
+String@List Leaf[list:out]
+{
+	If[[[list]Buffer >>]Length]
+	{
+		out <- Fold[_String Seq[?], "List", list]
+	}{
+		out <- "List\n\t{Empty}"
+	}
+}
+
+String@List[list:out]
+{
+	out <- Fold[_String Seq[?], "List", list]
+}
+
 Print@List[list:out]
 {
 	Print["List"]