This is second reply suggesting monads (the more the better). Do you
have any sources or examples (smaller the better) of the same problem in
a monadic and non-monadic way?
Thanks
Lukas
On 1/30/2010 7:21 AM, Konrad Hinsen wrote:
Lukas Lehner a écrit :
Now, imagine the chain of calling functions is relatively big. Here
it can all fall down on access-external-source causing an exception,
but further up, maybe the message is scrambled, or pretty much anything.
The question is, wrapping all function in try - catch does not make
is clearer (from a processing point of view). Returning nil from
broken functions just adds a boilerplate code all the way up.
One approach you might want to look at is the maybe monad
(clojure.contrib.monads/maybe-m). It takes care of (i.e. abstracts
away) the boilerplate for chaining together functions that return nil
to indicate failure.
Konrad
__________ Information provenant d'ESET NOD32 Antivirus, version de la
base des signatures de virus 4819 (20100130) __________
Le message a été vérifié par ESET NOD32 Antivirus.
http://www.eset.com
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en