aboutsummaryrefslogtreecommitdiff
path: root/sucl/history.icl
diff options
context:
space:
mode:
Diffstat (limited to 'sucl/history.icl')
-rw-r--r--sucl/history.icl28
1 files changed, 28 insertions, 0 deletions
diff --git a/sucl/history.icl b/sucl/history.icl
index f3b6c55..c0975a9 100644
--- a/sucl/history.icl
+++ b/sucl/history.icl
@@ -75,3 +75,31 @@ historyToString history
(writeHistoryAssociation) infixl :: *File (HistoryAssociation sym var) -> .File | toString sym & toString,== var
(writeHistoryAssociation) file ha = file <<< "<historyassociation>" // showpair toString (showlist toString) ha <<< nl
+
+printhistory ::
+ (sym->String)
+ (var->String)
+ String
+ (History sym var)
+ *File
+ -> .File
+ | == var
+
+printhistory showsym showvar indent history file
+= foldl (flip (printhistoryassociation showsym showvar indent)) file history
+
+printhistoryassociation showsym showvar indent vargraphs file
+= printlist (myshowrgraph showsym showvar) (indent+++" ") rgraphs (file <<< indent <<< showvar var <<< " <=" <<< nl)
+//= file <<< indent <<< showvar var <<< " <=" <<< showlist (showrgraph showsym showvar) rgraphs <<< nl
+//= file <<< indent <<< showpair showvar (showlist toString) vargraphs <<< nl
+//= file <<< "<history>" <<< nl
+ where (var,rgraphs) = vargraphs
+
+myshowrgraph showsym showvar rgraph
+= hd (printgraphBy showsym showvar (rgraphgraph rgraph) [rgraphroot rgraph])
+
+printlist :: (elem->String) String [elem] *File -> .File
+printlist showelem indent [] file
+= file
+printlist showelem indent [x:xs] file
+= printlist showelem indent xs (file <<< indent <<< showelem x <<< nl)