fsharp: eval 'shared across the time dimension' for step6.
[jackhill/mal.git] / fsharp / step0_repl.fs
1 module REPL
2 let READ input =
3 input
4
5 let EVAL ast =
6 ast
7
8 let PRINT v =
9 printfn "%s" v
10
11 let REP input =
12 input
13 |> READ
14 |> EVAL
15 |> PRINT
16
17 let getReadlineMode args =
18 if args |> Array.exists (fun e -> e = "--raw") then
19 Readline.Mode.Raw
20 else
21 Readline.Mode.Terminal
22
23 [<EntryPoint>]
24 let rec main args =
25 let mode = getReadlineMode args
26 match Readline.read "user> " mode with
27 | null -> 0
28 | input ->
29 REP input
30 main args