I am getting an error when trying to call doseq from within a defrecord
function, but I do not get the error with the same code outside of the
defrecord. Here is an example:
(defprotocol Fooable
(foo [this]))
(defn add-props [s properties] (doseq [p properties] (.add p)))
(defrecord Foo [properties]
Fooable
(foo [f]
(let [s (java.util.HashSet.)]
(doto s
(doseq [p properties] (.add s p))))))
When I load/reload the above code in the repl I get this error
<CompilerException java.lang.IllegalArgumentException: doseq requires a
vector for its binding (config.clj:22)>
If I change my defrecord to,
(defrecord Foo [properties]
Fooable
(foo [f]
(let [s (java.util.HashSet.)]
(doto s (add-props s properties)))))
I no longer get the compiler error. Can someone explain to me why I get this
error?
Thanks
- John
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en