id:amachangさんが遅延評価とかでいろいろやっているのを見て,ついかっとなってやってしまった。 少し長いけど,ようするにフィボナッチ数列をHaskell風に cons(0, cons(1, zipWith(add, fib, cdr(fib))))と書きたかった。 以下が実装。 function Cons (car, cdr) { if (car == null || cdr == null) { throw "illegal object."; } this.car = car; this.cdr = cdr; } function Action (act) { if (act == null) { throw "illegal object."; } this.action = act; } function Thunk (any) { if (any instanceof T