1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-20 18:18:51 +03:00

Ada: add Cond and Or macros

This commit is contained in:
Chris M Moore 2015-08-12 10:12:39 +01:00
parent d836bcfc17
commit a538515d88

View File

@ -59,7 +59,11 @@ begin
Rep ("(def! not (fn* (a) (if a false true)))");
LF_S : String :=
Rep ("(def! load-file (fn* (f) (eval (read-string (str ""(do "" (slurp f) "")"")))))");
pragma Unreferenced (Not_S, LF_S);
Cond_S : String :=
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)))))))");
Or_S : String :=
Rep ("(defmacro! or (fn* (& xs) (if (empty? xs) nil (if (= 1 (count xs)) (first xs) `(let* (or_FIXME ~(first xs)) (if or_FIXME or_FIXME (or ~@(rest xs))))))))");
pragma Unreferenced (Not_S, LF_S, Cond_S, Or_S);
begin
null;
end;