Re: RPN calculator in Perl 6

2009-06-08 Thread Daniel Ruoso
Em Sáb, 2009-06-06 às 19:51 +0200, Daniel Carrera escreveu: > Daniel Ruoso wrote: > > Yes... that's what wasn't implemented... But now it is ;) > > http://sial.org/pbot/37085 > Close, but... > % perl6 rpn.pl "5 4 + 3 / 5 3 - *" > -6 > That should be a positive 6. Fixed now! http://sial.org/pbot/37

Re: RPN calculator in Perl 6

2009-06-08 Thread Daniel Ruoso
Em Sáb, 2009-06-06 às 18:22 +0200, Daniel Carrera escreveu: > Daniel Ruoso wrote: > > er... that's because I didn't tried to implement it... but it > certainly > > is possible to, just by declaring the :(@a, Num $a) variant... > Well, * is implemented, so I guess you are talking about complex > ex

Re: RPN calculator in Perl 6

2009-06-08 Thread Daniel Ruoso
Em Sáb, 2009-06-06 às 14:06 +0200, Daniel Carrera escreveu: > I just wrote a blog post showing how to make a reverse polish notation > calculator in Perl 6. In the process I show some of Perl 6's grammar > features. TIMTOWTDI ;) http://sial.org/pbot/37075 daniel

Re: RPN calculator in Perl 6

2009-06-08 Thread Geoffrey Broadwell
On Sat, 2009-06-06 at 13:18 -0300, Daniel Ruoso wrote: > http://sial.org/pbot/37077 > A slightly improved syntax, as per jnthn++ suggestion... My list mail has been very delayed, so this may be out of sequence, but in case no one mentioned it yet: http://sial.org/pbot/37102 (That's ruoso++'

Re: RPN calculator in Perl 6

2009-06-08 Thread Daniel Ruoso
Em Dom, 2009-06-07 às 00:07 +0200, Daniel Carrera escreveu: > Daniel Ruoso wrote: > >> Are you planning to write a post explaining how your program works? > > Maybe, but if you want to beat me to it, feel free ;) > >> I figure that the explanation is as useful as the example. I sure > >> spent a lo

Re: RPN calculator in Perl 6

2009-06-08 Thread Daniel Ruoso
Em Sáb, 2009-06-06 às 19:45 -0400, Minimiscience escreveu: > my $ls = @a.shift; > my $rs = @a.shift; > To: > my $rs = @a.pop; > my $ls = @a.pop; Thanks... this was already solved in the latest version I sent http://sial.org/pbot/37089 daniel

Re: RPN calculator in Perl 6

2009-06-08 Thread Daniel Ruoso
http://sial.org/pbot/37077 A slightly improved syntax, as per jnthn++ suggestion... Em Sáb, 2009-06-06 às 18:08 +0200, Daniel Carrera escreveu: > Daniel Carrera wrote > > Ok, try again: > > % perl6 rpn.pl "2 2+" > > 2 2 > You can probably fix that with a different split() line. I tried using > i

Re: RPN calculator in Perl 6

2009-06-06 Thread Minimiscience
[I just realized I sent this directly to Daniel rather than to the list, so for the benefit of onlookers...] On Jun 6, 2009, at 1:51 PM, Daniel Carrera wrote: Daniel Ruoso wrote: Yes... that's what wasn't implemented... But now it is ;) http://sial.org/pbot/37085 Close, but... % perl6 rpn.

Re: RPN calculator in Perl 6

2009-06-06 Thread Daniel Carrera
Daniel Ruoso wrote: Are you planning to write a post explaining how your program works? Maybe, but if you want to beat me to it, feel free ;) I figure that the explanation is as useful as the example. I sure spent a lot of time writing the blog post. I'm not sure I'll have the time to write

Re: RPN calculator in Perl 6

2009-06-06 Thread Daniel Carrera
Daniel Ruoso wrote: Yes... that's what wasn't implemented... But now it is ;) http://sial.org/pbot/37085 Close, but... % perl6 rpn.pl "5 4 + 3 / 5 3 - *" -6 That should be a positive 6. Are you planning to write a post explaining how your program works? I figure that the explanation is as

Re: RPN calculator in Perl 6

2009-06-06 Thread Daniel Carrera
Daniel Ruoso wrote: You can probably fix that with a different split() line. I tried using instead of \s+ but the program just hangs forever. Hmm.. it certainly is in the split, I'm not sure how to get the barrier between the 2 and the + Does Perl 6 still have the word barrier \b regex?

Re: RPN calculator in Perl 6

2009-06-06 Thread Daniel Carrera
Daniel Carrera wrote Ok, try again: % perl6 rpn.pl "2 2+" 2 2 You can probably fix that with a different split() line. I tried using instead of \s+ but the program just hangs forever. I also tried a more complex expression, and the calculator didn't like it: % perl6 rpn.pl "5 4 + 3 / 5 3

Re: RPN calculator in Perl 6

2009-06-06 Thread Daniel Carrera
Daniel Carrera wrote: http://sial.org/pbot/37075 % perl rpn.pl "2 2 +" Tee hee... that should have been "perl6". :-) Ok, try again: % perl6 rpn.pl "2 2+" 2 2

Re: RPN calculator in Perl 6

2009-06-06 Thread Daniel Carrera
Daniel Ruoso wrote: TIMTOWTDI ;) The objective of the blog was more about the learning + teaching experience than anything else. http://sial.org/pbot/37075 % perl rpn.pl "2 2 +" Semicolon seems to be missing at rpn.pl line 2. String found where operator expected at rpn.pl line 13, near

RPN calculator in Perl 6

2009-06-06 Thread Daniel Carrera
seful. http://daniel.carrera.bz/2009/06/rpn-calculator-in-perl-6/ Cheers, Daniel.