X-Git-Url: https://git.hcoop.net/jackhill/mal.git/blobdiff_plain/29ba1fb6c0e5668a7c1feaa9b7a7d40a7f4bc8c3..26ced15b31c6ebfd77c7297a7f8d346ff08c3f9b:/vb/stepA_mal.vb diff --git a/vb/stepA_mal.vb b/vb/stepA_mal.vb index 013b6098..b10b43c2 100644 --- a/vb/stepA_mal.vb +++ b/vb/stepA_mal.vb @@ -122,7 +122,7 @@ Namespace Mal ' apply list Dim expanded As MalVal = macroexpand(orig_ast, env) if not expanded.list_Q() Then - return expanded + return eval_ast(expanded, env) End If Dim ast As MalList = DirectCast(expanded, MalList) @@ -183,7 +183,7 @@ Namespace Mal If TypeOf e Is Mal.types.MalException Then exc = DirectCast(e,Mal.types.MalException).getValue() Else - exc = New MalString(e.StackTrace) + exc = New MalString(e.Message) End If return EVAL( DirectCast(a2,MalList)(2), @@ -191,8 +191,8 @@ Namespace Mal DirectCast(a2,MalList).slice(1,2), New MalList(exc))) End If - Throw e End If + Throw e End Try Case "do" eval_ast(ast.slice(1, ast.size()-1), env) @@ -278,9 +278,6 @@ Namespace Mal REP("(def! not (fn* (a) (if a false true)))") REP("(def! load-file (fn* (f) (eval (read-string (str ""(do "" (slurp f) "")"")))))") REP("(defmacro! cond (fn* (& xs) (if (> (count xs) 0) (list 'if (first xs) (if (> (count xs) 1) (nth xs 1) (throw ""odd number of forms to cond"")) (cons 'cond (rest (rest xs)))))))") - REP("(def! *gensym-counter* (atom 0))") - REP("(def! gensym (fn* [] (symbol (str ""G__"" (swap! *gensym-counter* (fn* [x] (+ 1 x)))))))") - REP("(defmacro! or (fn* (& xs) (if (empty? xs) nil (if (= 1 (count xs)) (first xs) (let* (condvar (gensym)) `(let* (~condvar ~(first xs)) (if ~condvar ~condvar (or ~@(rest xs)))))))))") If args.Length > fileIdx Then REP("(load-file """ & args(fileIdx) & """)")