plsql: add dockerfile. Lots of cleanup/renaming.
[jackhill/mal.git] / guile / step8_macros.scm
index c6df4e0..af36411 100644 (file)
@@ -18,7 +18,7 @@
 
 (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> ")))
@@ -54,6 +54,7 @@
 
 (define (is_macro_call ast env)
   (and (list? ast)
+       (> (length ast) 0)
        (and=> (env-check (car ast) env) is-macro?)))
 
 (define (_macroexpand ast env)
@@ -91,6 +92,7 @@
     (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))))