2 // @import types/boxed/*.ck
3 // @import types/MalObject.ck
4 // @import types/mal/MalAtom.ck
5 // @import types/mal/MalError.ck
6 // @import types/mal/MalNil.ck
7 // @import types/mal/MalFalse.ck
8 // @import types/mal/MalTrue.ck
9 // @import types/mal/MalInt.ck
10 // @import types/mal/MalString.ck
11 // @import types/mal/MalSymbol.ck
12 // @import types/mal/MalKeyword.ck
13 // @import types/mal/MalList.ck
14 // @import types/mal/MalVector.ck
15 // @import types/mal/MalHashMap.ck
20 fun MalObject READ(string input)
22 return Reader.read_str(input);
25 fun MalObject EVAL(MalObject m)
30 fun string PRINT(MalObject m)
32 return Printer.pr_str(m, true);
35 fun string errorMessage(MalObject m)
37 (m$MalError).value() @=> MalObject value;
38 return "exception: " + Printer.pr_str(value, true);
41 fun string rep(string input)
43 READ(input) @=> MalObject m;
45 if( m.type == "error" )
47 return errorMessage(m);
51 return PRINT(EVAL(m));
61 Readline.readline("user> ") => string input;
65 rep(input) => string output;
67 if( output == "empty input" )
69 // proceed immediately with prompt