论坛首页 AJAX版 JavaScript

JavaScript Monads

浏览 2386 次
精华帖 (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]
   
时间:2007-06-03
请问JS is Best Language这篇article可以在哪里找到?
Thanks in advanced!
   
0 请登录后投票
时间:2007-06-03
找到了!
这是一篇很好的JS pdf!
http://alex.dojotoolkit.org/wp-content/AOP_and_FP_in_JS.pdf
   
0 请登录后投票
时间:2007-06-04
我对monad不太懂,只知道是haskell里处理可变性如io的。谁给解释一下?
   
0 请登录后投票
论坛首页 AJAX版 JavaScript

跳转论坛:
JavaEye推荐