multi scoping

2005-09-04 Thread Luke Palmer
Here's a good Perl 6 final exam question: Spot the mistake (hint: it's not in the math): module Complex; sub i() is export { Complex.new(0,1) } multi sub infix:<+> (Complex $left, Complex $right) is export { Complex.new($left.real + $right.real, $left.imag + $rig

Re: multi scoping

2005-09-04 Thread Yuval Kogman
On Sun, Sep 04, 2005 at 07:55:21 +, Luke Palmer wrote: > Here's a good Perl 6 final exam question: > > Spot the mistake (hint: it's not in the math): > > module Complex; > > sub i() is export { > Complex.new(0,1) > } > multi sub infix:<+> (Complex $left, Complex $rig

Re: multi scoping

2005-09-04 Thread Luke Palmer
On 9/4/05, Yuval Kogman <[EMAIL PROTECTED]> wrote: > I always saw scoping of multis as something that applies to the > variants... > > multi sub foo { > > } > > { > my multi sub foo { > > } > >

FYI: Lambda Calculus on Perl 6

2005-09-04 Thread Dan Kogai
Folks, I recently needed to write a series of codes on lambda calculus in perl. As MJD has shown Perl 5 can handle lambda calculus but I am beginning to get tired of whole bunch of 'my $x = shift' needed. our $ZERO = sub { my $f = shift; sub { my $x = shift; $x }}; our

Re: FYI: Lambda Calculus on Perl 6

2005-09-04 Thread Autrijus Tang
On 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