Browse files

Extend to EmptyList

This is needed when the code walker is used in macros. The Clojure
compiler throws an exception if a macro expands to a lazy sequence
instead of an IPersistentList.
1 parent f14f45a commit 730eb756dcc424aa535d0872bd626079955c3892 @stuartsierra committed Jul 29, 2013
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/clojure/walk2.clj
@@ -29,6 +29,8 @@
clojure.lang.PersistentList ; special case to preserve type
(walkt [coll f]
(apply list (map f coll)))
+ clojure.lang.PersistentList$EmptyList ; special case to preserve type
+ (walkt [coll f] '())
clojure.lang.IRecord ; any defrecord
(walkt [coll f]
(reduce (fn [r x] (conj r (f x))) coll coll)))

0 comments on commit 730eb75

Please sign in to comment.