(define *toplevel*
(receive (b e) (unzip2 core.ns)
- (make-Env #:binds b #:exprs (map (lambda (x) (make-func x)) e))))
+ (make-Env #:binds b #:exprs (map make-func e))))
(define (READ)
(read_str (_readline "user> ")))
(define (is_macro_call ast env)
(and (list? ast)
+ (> (length ast) 0)
(and=> (env-check (car ast) env) is-macro?)))
(define (_macroexpand ast env)
(let ((ast (_macroexpand ast env)))
(match ast
((? non-list?) (eval_ast ast env))
+ (() ast)
(('defmacro! k v)
(let ((c (EVAL v env)))
(callable-is_macro-set! c #t)
(let ((args (cdr (command-line))))
(cond
((> (length args) 0)
- (for-each (lambda (f) (EVAL-string (string-append "(load-file \"" f "\")"))) args))
- (else
- ((*toplevel* 'set) '*ARGV* args)
- (REPL))))
+ ((*toplevel* 'set) '*ARGV* (cdr args))
+ (EVAL-string (string-append "(load-file \"" (car args) "\")")))
+ (else (REPL))))