Merge pull request #358 from theanalyst/feature/macros-none
Allow macros to return None, fixes #357
This commit is contained in:
commit
699396b5a3
@ -84,7 +84,8 @@ _wrappers = {
|
|||||||
complex: HyComplex,
|
complex: HyComplex,
|
||||||
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),
|
||||||
|
type(None): lambda foo: HySymbol("None"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,6 +34,9 @@
|
|||||||
(defmacro a-dict [] {1 2})
|
(defmacro a-dict [] {1 2})
|
||||||
(assert (= (a-dict) {1 2}))
|
(assert (= (a-dict) {1 2}))
|
||||||
|
|
||||||
|
(defmacro a-none [])
|
||||||
|
(assert (= (a-none) None))
|
||||||
|
|
||||||
; A macro calling a previously defined function
|
; A macro calling a previously defined function
|
||||||
(eval-when-compile
|
(eval-when-compile
|
||||||
(defn foo [x y]
|
(defn foo [x y]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user