4 (require "types.rkt" "readline.rkt" "reader.rkt" "printer.rkt")
11 (define (eval-ast ast env)
15 (lambda () (raise (string-append "'"
18 [(_sequential? ast) (_map (lambda (x) (EVAL x env)) ast)]
19 [(hash? ast) (make-hash
20 (dict-map ast (lambda (k v) (cons k (EVAL v env)))))]
23 (define (EVAL ast env)
27 (let* ([el (eval-ast ast env)]
37 (define repl-env (hash '+ + '- - '* * '/ /))
39 (PRINT (EVAL (READ str) repl-env)))
42 (let ([line (readline "user> ")])
43 (when (not (eq? nil line))
45 ([string? (lambda (exc) (printf "Error: ~a~n" exc))]
46 [blank-exn? (lambda (exc) null)])
47 (printf "~a~n" (rep line)))