set the value of empty hy expression to []

This commit is contained in:
Guillermo Vaya 2013-06-26 01:40:10 +02:00 committed by Nicolas Dandrimont
parent 9b45dd4ffe
commit 7b7b953410
2 changed files with 10 additions and 1 deletions

View File

@ -70,7 +70,12 @@ _wrappers = {
def process(tree, module_name):
if isinstance(tree, HyExpression):
fn = tree[0]
try:
fn = tree[0]
except IndexError:
ntree = HyList()
ntree.replace(tree)
return ntree
if fn in ("quote", "quasiquote"):
return tree
ntree = HyExpression(

View File

@ -755,3 +755,7 @@
(continue))
(.append y x))
(assert (= y [5])))
(defn test-empty-list []
"Evaluate an empty list to a []"
(assert (= () [])))