1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-20 18:18:51 +03:00
mal/io/step1_read_print.io
2016-03-07 08:58:28 -05:00

23 lines
426 B
Io

MalTypes
MalReader
READ := method(str, MalReader read_str(str))
EVAL := method(ast, env, ast)
PRINT := method(exp, exp malPrint(true))
RE := method(str, EVAL(READ(str), nil))
REP := method(str, PRINT(RE(str)))
loop(
line := MalReadline readLine("user> ")
if(line isNil, break)
if(line isEmpty, continue)
e := try(REP(line) println)
e catch(Exception,
("Error: " .. (e error)) println
)
)