Entries from 2015-04-01 to 1 month

Scheme手習い 10章 インタープリタ

Scheme手習い10章のインタープリタを書いてみた。 (define value (lambda (e) (meaning e '()))) (define meaning (lambda (e table) ((expression-to-action e) e table))) (define expression-to-action (lambda (e) (cond [(atom? e) (atom-to-action e)]…

JavaScriptでYコンビネータ

function Y(M){ return (function(f){ return M(function(a){ return f(f)(a); }); }) (function(f){ return M(function(a){ return f(f)(a); }); }); } function fib(r){ return function(n){ return (n <= 2)? 1 : r(n-1) + r(n-2); }; } console.log(Y(fi…

Scheme手習いを読むとYコンビネータがわかるよ

「プログラミングGauche」の継続のところが理解できず、「Scheme手習い」という本に手を出した。このシリーズの本は、現在、3冊出版されているようだ。「Scheme手習い」、「Scheme修行」、「The Reasond Schemer」の3冊である。「The Reasond Schemer」は翻…