mirror of
https://github.com/kanaka/mal.git
synced 2024-09-21 02:27:10 +03:00
Ada: add Cond and Or macros
This commit is contained in:
parent
d836bcfc17
commit
a538515d88
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user