[ALGOM-10] :when clause in domonad relies on optional m-zero monad operation Created: 30/May/13 Updated: 03/Jun/13
|Reporter:||Glenn Vanderburg||Assignee:||Konrad Hinsen|
In add-monad-step, the :when clause is implemented by this line:
which makes sense, except that m-zero is an optional operation for monads.
I don't know that it's possible to make this work reasonably for all monads,
|Comment by Glenn Vanderburg [ 03/Jun/13 8:23 AM ]|
After more thinking, I think the best behavior would be to evaluate to m-zero if it's defined, and (m-result nil) otherwise. The behavior of :when is too useful with the state monad, and too cumbersome to duplicate with :if :then :else, to simply document the issue. The standard Clojure when macro evaluates to nil if the condition is false.