-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
a lazier plus function? #6
Comments
I've implemented a variant of It involves another method for the The end result is that the two tests you had commented out in The idea is that if the developer needs a "lazier" By the way, I've got a fair number of changes / experiments in progress on my Consider the following: (binding [m/*throw-on-mismatch* true]
(m/do list
[x (range 5)
y (range 3)]
(+ x y))) With We can "fix" the example like so: (binding [m/*throw-on-mismatch* true]
(m/do list
[x (into '() (range 5))
y (into '() (range 3))]
(+ x y))) Now all the types are aligned, and no exception will be thrown. As suggested, this is "overly strict" since Well, this is getting somewhat far afield from the issue at hand ("lazier plus"), but I wanted to give you a heads-up. I have no idea whether you'll actually end up wanting to merge in these changes and features, but this has been a huge learning experience for me and I want to thank you for all the hard work you've put into this library. It's really well written, and it's been my pleasure to take it apart and figure out how it works (and how I can put it to good use!) |
In your plus* you might eliminate the need for a let with some destructuring of the arg like this defmacro plus* [[mv & mvs]] ... ) |
Destructuring the argument for I fixed my implementation of "regular" Long story short, in the My thought is that, per convention and documentation (to come at some point), |
I've been studying the library and its test suite, trying to come to terms with monads.
I became interested in the test which is commented out on line 269 in
test/core.clj
.Is the problem with
maybe-monad
as such? Or is it a "laziness issue" with respect to theplus
function defined on line 13 inmonads/core.clj
?Here are the relevant bits of a hack which I cooked up today:
https://gist.github.com/3989325
It's ugly, and I realize that bringing
eval
into the picture isn't a proper solution. Also, with that hack in place, other parts of the library don't work correctly and many of its tests fail.This is a learning exercise for me, and you may already be aware of the underlying problem, but I wanted to share my "hack" and get your thoughts on how a "lazier"
plus
/plus-step
might be properly implemented.The text was updated successfully, but these errors were encountered: