Let's hypothetically say I have a Ring application and I'm performing some
validation on the input map I receive as part of a POST request. The
validate function throws an exception if anything's wrong with the input.
The exception is caught in the middleware and turned into a 400 code
response.
I could do either:
(-> input
validate
save)
or I could do:
(do
(validate input)
(save input))
The former doesn't really buy me anything, since a new version of input
would never be returned by validate. It is however "side-effect free" in a
way?
The latter is probably less idiomatic, but makes it obvious that input is
not changing as part of the evaluation.
What would be the more elegant way of handling this? Is the do block
approach somehow inferior?
Thanks!
--
--
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.