One would expect the form:

    > (defmacro a (&rest b) b)
    > (a 1 2)

To return a tuple object but we have no Hy model so it returns a HyList.
Not sure if this is the right thing to do.
This commit is contained in:
James King 2014-02-19 00:09:37 -05:00
parent c1147c93a8
commit b97e0258e1
2 changed files with 4 additions and 0 deletions

View File

@ -115,6 +115,7 @@ _wrappers = {
str_type: HyString, str_type: HyString,
dict: lambda d: HyDict(_wrap_value(x) for x in sum(d.items(), ())), dict: lambda d: HyDict(_wrap_value(x) for x in sum(d.items(), ())),
list: lambda l: HyList(_wrap_value(x) for x in l), list: lambda l: HyList(_wrap_value(x) for x in l),
tuple: lambda t: HyList(_wrap_value(x) for x in t),
type(None): lambda foo: HySymbol("None"), type(None): lambda foo: HySymbol("None"),
} }

View File

@ -31,6 +31,9 @@
(defmacro a-list [] [1 2]) (defmacro a-list [] [1 2])
(assert (= (a-list) [1 2])) (assert (= (a-list) [1 2]))
(defmacro a-tuple [&rest b] b)
(assert (= (a-tuple 1 2) [1 2]))
(defmacro a-dict [] {1 2}) (defmacro a-dict [] {1 2})
(assert (= (a-dict) {1 2})) (assert (= (a-dict) {1 2}))