As others have noted, this is pretty much what monads are made for. I've
found Brian Marick's "Functional Programming for the Object-Oriented
Programmer"'s chapter on monads really good at teaching how to recognize
situations where monads would be a good fit.
For this specific use-case, you can pr
You could use exceptions, is that a hard requirement or are you working to
transition your mental model for Java code to Clojure?
If you can catch the exceptions or not throw them to begin with there’s
some other options;
Another way you could do it is using core.async and channels as some others
Now that bertschi mentioned Haskell and side-effects, I noticed that the
problem we have here totally looks like a monad:
we have several steps of side-effecting computation, and each of them can
fail, and when this happens you want to handle the failure while keeping
the previous bindings.
Now, w
On Monday, October 2, 2017 at 11:04:52 PM UTC+2, Didier wrote:
>
> > Even in an impure language such as Common Lisp we frown on such LET forms
>
> True, but as far as I know, in Common Lisp, the condition handler is
> always in scope of where the error happened, so I wouldn't face this
> proble
> Even in an impure language such as Common Lisp we frown on such LET forms
True, but as far as I know, in Common Lisp, the condition handler is always in
scope of where the error happened, so I wouldn't face this problem.
I also struggle to split this up into functions without making it even mo
On Saturday, September 30, 2017 at 6:14:33 PM UTC-4, Didier wrote:
>
> I'm curious how others handle this use case, which I feel should be pretty
> common.
>
> Given you have a series of business process steps, where the flow is too
> complex for the arrow macros, and you also like to name the
> On Oct 1, 2017, at 9:21 PM, Didier wrote:
>
> I can't emphasize enough the utility of the interceptor chain pattern, as
> employed heavily in pedestal.
>
> Interesting... Its almost like a workflow framework, but for simpler in code
> workflows. I'm reluctant to have a dependency on pedest
Didier, I've done something similar a few times just using core.async -- no
extra deps required ;-)
d
On 1 October 2017 at 23:21, Didier wrote:
> I can't emphasize enough the utility of the interceptor chain pattern, as
>> employed heavily in pedestal.
>>
>
> Interesting... Its almost like a w
Hi Didier
The interceptor pattern is pretty tiny, certainly small enough to copy from
project to project if you wanted. You can see re-frame's implementation
here:
https://github.com/Day8/re-frame/blob/master/src/re_frame/interceptor.cljc
which
is only around 100 SLOC. That doesn't handle exceptio
>
> I can't emphasize enough the utility of the interceptor chain pattern, as
> employed heavily in pedestal.
>
Interesting... Its almost like a workflow framework, but for simpler in
code workflows. I'm reluctant to have a dependency on pedestal just for
this though.
On Sunday, 1 October 201
> On Sep 30, 2017, at 3:14 PM, Didier wrote:
>
> Is there another way to execute a set of complex steps which does not rely on
> let and can be try/catched in the manner I describe?
I can't emphasize enough the utility of the interceptor chain pattern, as
employed heavily in pedestal.
I use
I've seen this, I was still curious if the reason I was facing the issue
was that let is simply the wrong tool for my use case or not.
If let is the correct tool, I would propose that clojure.core should had a
try/catch where the catch is in scope of the try. I feel the reason this is
contrived
I've used try-let (link below) for this, it's worked great!
https://github.com/rufoa/try-let
--
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
I'm curious how others handle this use case, which I feel should be pretty
common.
Given you have a series of business process steps, where the flow is too
complex for the arrow macros, and you also like to name the step results
descriptively, so you use let:
(let [a (do-a ...)
b (do-b .
14 matches
Mail list logo