Changing cond to be more common lisp / emacs lisp like
Instead of: (cond (condition-1) (body-1) (condition-2) (body-2)) We now work like: (cond ((condition-1) (body-1) (condition-2) (body-2)))
This commit is contained in:
parent
a0acbd7948
commit
9416422330
@ -36,12 +36,11 @@ def defn_macro(tree):
|
|||||||
def cond_macro(tree):
|
def cond_macro(tree):
|
||||||
tree.pop(0) # cond flag
|
tree.pop(0) # cond flag
|
||||||
it = iter(tree)
|
it = iter(tree)
|
||||||
conds = iter(zip(it, it))
|
test, branch = next(it)
|
||||||
test, branch = next(conds)
|
|
||||||
|
|
||||||
root = HyExpression([HySymbol("if"), test, branch])
|
root = HyExpression([HySymbol("if"), test, branch])
|
||||||
ret = root
|
ret = root
|
||||||
for (test, branch) in conds:
|
for (test, branch) in it:
|
||||||
n = HyExpression([HySymbol("if"), test, branch])
|
n = HyExpression([HySymbol("if"), test, branch])
|
||||||
ret.append(n)
|
ret.append(n)
|
||||||
ret = n
|
ret = n
|
||||||
|
@ -78,8 +78,8 @@
|
|||||||
(defn test-cond []
|
(defn test-cond []
|
||||||
"NATIVE: test if cond sorta works."
|
"NATIVE: test if cond sorta works."
|
||||||
(cond
|
(cond
|
||||||
(= 1 2) (assert (= true false))
|
((= 1 2) (assert (= true false)))
|
||||||
(is null null) (assert (= true true))))
|
((is null null) (assert (= true true)))))
|
||||||
|
|
||||||
|
|
||||||
(defn test-index []
|
(defn test-index []
|
||||||
|
Loading…
Reference in New Issue
Block a user