浏览 2386 次
|
锁定老贴子 主题:JavaScript Monads
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
|---|---|
| 作者 | 正文 |
|
时间:2006-09-03
from "JS is Best Language" article.
--------------------------- JavaScript Monads (with aplogies to Shannon Behrens) 20 [code:1] function MonadClass(value){ this.value = value || undefined; } MonadClass.prototype.pass = function(value, cb, scope){ if(typeof value[”value”] == “undefined”){ return new this.constructor(); } // side effects go here! if(scope){ return cb.call(scope, value); } return cb(value); } [/code:1] 声明:JavaEye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|
|
| 返回顶楼 | |
|
时间:2007-06-03
请问JS is Best Language这篇article可以在哪里找到?
Thanks in advanced! |
|
| 返回顶楼 | |
|
时间:2007-06-03
找到了!
这是一篇很好的JS pdf! http://alex.dojotoolkit.org/wp-content/AOP_and_FP_in_JS.pdf |
|
| 返回顶楼 | |
|
时间:2007-06-04
我对monad不太懂,只知道是haskell里处理可变性如io的。谁给解释一下?
|
|
| 返回顶楼 | |






