TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Monads in Clojure

71 点作者 rohshall超过 12 年前

8 条评论

monkeyfacebag超过 12 年前
I appreciate these attempts to give non-Haskellers a chance to learn Monads but, personally, I never really grokked them until I got into Haskell. In Haskell, Monads are defined in terms of types, thus languages without type systems like Haskell's make the concept both more difficult to understand <i>and</i> less (immediately) useful. Having been through many of these tutorials myself, I think the best way to get into Monads (as well as many other useful constructs like Functors, Monoids and Monad Transformers) is to roll up your sleeves and learn Haskell (Learn You A Haskell is a great and relatively quick read). As a bonus, you'll also learn one of the most elegant programming languages around.<p>This comment isn't intended as a knock against the article. I think there's a lot of merit in using monadic constructs in languages that aren't Haskell, I just think Haskell's type system makes understanding the concept easier.
评论 #4441867 未加载
评论 #4442374 未加载
评论 #4441932 未加载
评论 #4441856 未加载
breckinloggins超过 12 年前
&#62; The idea behind a monad is to factor out the plumbing code so that its complexity is hidden, leaving only the composition of the functions visible.<p><i>cue light bulb coming on</i><p>Thanks so much for this article; I've been trying to understand monads forever now. The closest I got was the "burrito" analogy, but I always wanted a more mathematically sound intuition.<p>For helpful reference, here's a collection of monad tutorials and related pedagogy:<p>- Monads are burritos [<a href="https://speakerdeck.com/u/dimituri/p/a-monad-is-just-a-burrito" rel="nofollow">https://speakerdeck.com/u/dimituri/p/a-monad-is-just-a-burri...</a>] (slide deck)<p>- No, they really aren't [<a href="http://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the-monad-tutorial-fallacy/" rel="nofollow">http://byorgey.wordpress.com/2009/01/12/abstraction-intuitio...</a>]<p>- Well yeah, they kinda are [<a href="http://blog.plover.com/prog/burritos.html" rel="nofollow">http://blog.plover.com/prog/burritos.html</a>]<p>- But anyway, you probably have already invented them yourself; you just didn't realize it [<a href="http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html" rel="nofollow">http://blog.sigfpe.com/2006/08/you-could-have-invented-monad...</a>]<p>- And even if you didn't, you can always learn about it from that crowd-sourced fountain of programmer knowledge, StackOverflow (and this question hasn't even been closed as "not constructive"!) [<a href="http://stackoverflow.com/questions/44965/what-is-a-monad" rel="nofollow">http://stackoverflow.com/questions/44965/what-is-a-monad</a>]<p>- Of course, once you understand basic category theory, you should be set anyway. What are you, some kind of Java programmer? [<a href="http://reperiendi.wordpress.com/2007/11/03/category-theory-for-the-java-programmer/" rel="nofollow">http://reperiendi.wordpress.com/2007/11/03/category-theory-f...</a>]<p>- But really, a monad is just a monoid in the category of endofunctors, what's the problem? [<a href="http://stackoverflow.com/questions/3870088/a-monad-is-just-a-monoid-in-the-category-of-endofunctors-whats-the-problem" rel="nofollow">http://stackoverflow.com/questions/3870088/a-monad-is-just-a...</a>]
brehaut超过 12 年前
The author of this article, Jim Duey, has written some newer introductions to monads in clojure on his new site: <a href="http://www.clojure.net/archive.html" rel="nofollow">http://www.clojure.net/archive.html</a>
jballanc超过 12 年前
Just a note for anyone hoping to follow along at home: clojure.contrib has been deprecated and the various parts have either moved or been left to bitrot on the vine. Pertinent to this article, "clojure.contrib.monads" is now "clojure.algo.monads".<p>You can find out what happened to the rest of clojure.contrib here: <a href="http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go" rel="nofollow">http://dev.clojure.org/display/design/Where+Did+Clojure.Cont...</a>
michaelcampbell超过 12 年前
I met the author (after having seen his video of this subject) at clojure/conj 2011. Fascinating guy, and can really explain this stuff in more or less terms I can understand.<p>I don't use it enough to "get it" so I have to re-learn it every time I feel the need to, but this is the go-to spot for me.
ozataman超过 12 年前
Nice article. On the other hand, in a slightly joking manner, I really wonder how some people can live with 8-space tabs with 8+ levels of indentation!
评论 #4442684 未加载
tsewlliw超过 12 年前
It IS really nice to see something on those mysterious monads not written in haskell. I got hung up early into the article though, where the author says something to the effect of "the monad hides the complexity", and that seemed like a silly goal. I need to make another pass at it.
评论 #4442032 未加载
sutro超过 12 年前
I remember how happy I was the first time I really grasped my nads.