From:

Date:

September 4, 2005 23:11Subject:

Re: FYI: Lambda Calculus on Perl 6Message ID:

20050905061111.GA25085@aut.dyndns.orgOn Mon, Sep 05, 2005 at 12:35:36PM +0900, Dan Kogai wrote: > And I found that these can be made much, much simpler and more > intuitive with Perl 6, even more so than scheme! > > our $ZERO = sub($f){ sub($x){ $x }}; > our $SUCC = sub($n){ sub($f){ sub($x){ $f.($n.($f)($x)) }}}; > our $ADD = sub($m){ sub($n){ sub($f){ sub($x){ $m.($f)($n.($f) > ($x)) }}}}; > our $MULT = sub($m){ sub($n){ sub($f){ $m.($n.($f)) }}}; > our $POW = sub($m){ sub($n){ $n.($m) }}; Nice! Also the pointy notation may or may not be clearer: -> $f { -> $x { $x } } Also, you can use the & sigil: our &SUCC := sub(&n){ sub(&f){ sub(&x){ f(n(&f)(&x)) }}}; which may or may not be clearer... probably not, come to think about it. > P.S. I am surprised to find Pugs does not include this kind of > sample scripts. I'm surprised to find dan-san is not a Pugs committer. I've remedied this situation by sending you an invitation. The commit URL is the same as the anonymous checkout svn URL. Please commit them into the suitable examples/ subdirectory, probably "algorithms". Also please add yourself to AUTHORS. Welcome aboard! Thanks, /Autrijus/Thread Previous

- FYI: Lambda Calculus on Perl 6 by Dan Kogai
**Re: FYI: Lambda Calculus on Perl 6**by Autrijus Tang

nntp.perl.org: Perl Programming lists via nntp and http.

Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About