Skip to content

Commit

Permalink
hy: Add missing cond macro
Browse files Browse the repository at this point in the history
  • Loading branch information
wasamasa committed Oct 23, 2017
1 parent 2ff47a3 commit 27a793e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions hy/stepA_mal.hy
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
(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)))))))))")
(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)))))))")

(defmain [&rest args]
(if (>= (len args) 2)
Expand Down

0 comments on commit 27a793e

Please sign in to comment.