From 9416422330cac610952465683eeceef68e7e2557 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Mon, 1 Apr 2013 10:33:45 -0500 Subject: [PATCH] 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))) --- hy/core/bootstrap.py | 5 ++--- tests/native_tests/language.hy | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hy/core/bootstrap.py b/hy/core/bootstrap.py index a9e0a96..fbf9d31 100644 --- a/hy/core/bootstrap.py +++ b/hy/core/bootstrap.py @@ -36,12 +36,11 @@ def defn_macro(tree): def cond_macro(tree): tree.pop(0) # cond flag it = iter(tree) - conds = iter(zip(it, it)) - test, branch = next(conds) + test, branch = next(it) root = HyExpression([HySymbol("if"), test, branch]) ret = root - for (test, branch) in conds: + for (test, branch) in it: n = HyExpression([HySymbol("if"), test, branch]) ret.append(n) ret = n diff --git a/tests/native_tests/language.hy b/tests/native_tests/language.hy index f8cd50a..e3f4f84 100644 --- a/tests/native_tests/language.hy +++ b/tests/native_tests/language.hy @@ -78,8 +78,8 @@ (defn test-cond [] "NATIVE: test if cond sorta works." (cond - (= 1 2) (assert (= true false)) - (is null null) (assert (= true true)))) + ((= 1 2) (assert (= true false))) + ((is null null) (assert (= true true))))) (defn test-index []