Hi
I have the following function:
(defn group
[& validators]
(fn [m]
(reduce (fn [maps f]
(let [[m error-m] maps
[new-map errors] (f m)]
[new-map (vec (flatten (if errors (conj error-m errors)
error-m)))]))
[m []]
validators
)))
The following call (def foo group) returns a function. All as I'd expect. I
then thought I'd replace the anonymous function with a named function...
(defn validate
[maps f]
(let [[m error-m] maps
[new-map errors] (f m)]
[new-map (vec (flatten (if errors (conj error-m errors) error-m)))]))
(defn group2
[& validators]
(fn [m]
(reduce validate
[m []]
validators
)))
The following call (def foo group2) returns an empty vector. I would have
though it would have returned a function. Am I missing something?
cheers
Dave
--
--
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
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.