From 7958bfe952186caa08f46c1ec99cc1ea40a8edb2 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 18 Oct 2016 23:40:21 +0200 Subject: Cleanup --- iclean.icl | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'iclean.icl') diff --git a/iclean.icl b/iclean.icl index dce11f3..6b64d98 100644 --- a/iclean.icl +++ b/iclean.icl @@ -58,27 +58,27 @@ Start w # w = checkedWorldFunc writeHistory "Couldn't write history" readline_history w = w where - loop :: ![String] Bool !*World -> *World - loop mem success w - # prompt = color (if success None Red) "λ. " - # (s,w) = readLine prompt False w - | isNothing s = print "\n" w - # s = fromJust s - | s == "" = loop mem False (print "Use Ctrl-D to exit\n" w) - # w = addHistory s w - | s == ":quit" || s == ":q" = w - | s == ":mem" = loop mem True (print (join "\n" mem) w) - | matches ":import " s = loop (mem ++ [skip 1 s]) True w - | matches ":def " s = loop (mem ++ [skip 5 s]) True w + loop :: ![String] Bool !*World -> *World + loop mem success w + # prompt = color (if success None Red) "λ. " + # (s,w) = readLine prompt False w + | isNothing s = print "\n" w + # s = fromJust s + | s == "" = loop mem False (print "Use Ctrl-D to exit\n" w) + # w = addHistory s w + | s == ":quit" || s == ":q" = w + | s == ":mem" = loop mem True (print (join "\n" mem) w) + | matches ":import " s = loop (mem ++ [skip 1 s]) True w + | matches ":def " s = loop (mem ++ [skip 5 s]) True w | matches ":undef " s = loop (filter (undef (skip 7 s)) mem) True w | s == ":help" = loop mem True (print help w) - | matches ":" s = loop mem False (print ("Unknown command\n") w) - # w = writemodule mem s w - # (r,w) = compile temp_path temp_module w - | r <> 0 = loop mem False w - # (r,w) = run (temp_path +++ temp_module) w - | r <> 0 = loop mem False w - = loop mem True w + | matches ":" s = loop mem False (print ("Unknown command\n") w) + # w = writemodule mem s w + # (r,w) = compile temp_path temp_module w + | r <> 0 = loop mem False w + # (r,w) = run (temp_path +++ temp_module) w + | r <> 0 = loop mem False w + = loop mem True w undef :: !String !String -> Bool undef n h = not (matches (n +++ " ") h) @@ -115,10 +115,10 @@ writemodule mem s w // C functions compile :: !String !String !*World -> *(!Int,!*World) compile _ _ _ = code { - ccall compile "SS:p:A" + ccall compile "SS:p:A" } run :: !String !*World -> (!Int, !*World) run _ _ = code { - ccall run "S:I:A" + ccall run "S:I:A" } -- cgit v1.2.3