error when using -> as lambda function

2006-10-03 Thread Wim Vanderbauwhede
Hi all, I encountered this strange error in pugs (in 6.2.11,6.2.12 and the latest svn) My first program (lambda1.p6) calculates the factorial of 5 using -> as lambda functions: say (-> $n { -> $f { $f($n,$f) }.( -> $n, $f { $n<2 ?? 1 !! $n*$f($n-1,$f) }) }).(5); say "OK"; say "OK"; $ pugs lamb

Re: error when using -> as lambda function

2006-10-03 Thread Audrey Tang
在 Oct 3, 2006 10:22 PM 時,Wim Vanderbauwhede 寫到: say (-> $n { -> $f { $f($n,$f) }.( -> $n, $f { $n<2 ?? 1 !! $n*$f ($n-1,$f) }) }).(5); say "OK"; #say (-> $n { -> $f { $f($n,$f) }.( -> $n, $f { $n<2 ?? 1 !! $n*$f ($n-1,$f) }) }).(5); say "OK"; It's extremely subtle -- $n<2 should never have

Re: "Don't tell me what I can't do!"

2006-10-03 Thread Aaron Sherman
chromatic wrote: On Monday 02 October 2006 12:32, Jonathan Lang wrote: Before we start talking about how such a thing might be implemented, I'd like to see a solid argument in favor of implementing it at all. What benefit can be derived by letting a module specify additional strictures for its

Re: Nested statement modifiers.

2006-10-03 Thread Aaron Sherman
Trey Harris wrote: In a message dated Fri, 1 Sep 2006, jerry gay writes: On 9/1/06, Trey Harris <[EMAIL PROTECTED]> wrote: In a message dated Fri, 1 Sep 2006, Paul Seamons writes: > I'm not sure if I have seen this requested or discussed. This was definitively rejected by Larry in 2002: p

Re: Nested statement modifiers.

2006-10-03 Thread Paul Seamons
> Of course, that wasn't exactly what you were asking, but it does present > a practical solution when you want to: > > {say $_ for =<>}.() if $do_read_input; > > Which I just verified works fine under current pugs. Thank you. Hadn't thought of that. I think that is workable. But it also

[perl #40449] [PATCH] improvements to examples/io/httpd.pir

2006-10-03 Thread via RT
# New Ticket Created by Chris Dolan # Please include the string: [perl #40449] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=40449 > This patch makes the following simple improvements to the example HTTP server that ship

Re: [perl #40449] [PATCH] improvements to examples/io/httpd.pir

2006-10-03 Thread chromatic
On Tuesday 03 October 2006 08:46, Chris Dolan wrote: > This patch makes the following simple improvements to the example > HTTP server that ships with Parrot: > > * Bugfix for 404 responses > * Disallow urls containing ".." > * Un-hardcode the server host name > * Move the server name ("Pa

Re: Nested statement modifiers.

2006-10-03 Thread Aaron Sherman
Paul Seamons wrote: Of course, that wasn't exactly what you were asking, but it does present a practical solution when you want to: {say $_ for =<>}.() if $do_read_input; Which I just verified works fine under current pugs. Thank you. Hadn't thought of that. I think that is workable

[svn:parrot-pdd] r14840 - in trunk: . docs/pdds/clip

2006-10-03 Thread chip
Author: chip Date: Tue Oct 3 12:36:36 2006 New Revision: 14840 Removed: trunk/docs/pdds/clip/pdd07_codingstd.pod Changes in other areas also in this revision: Modified: trunk/ (props changed) Log: Remove redundant pdd07 (closes: #40419)

Wikipedia example

2006-10-03 Thread Aaron Sherman
I'm finally getting around to sending this patch as requested on IRC... dang commit bits are rare around here ;) This contains the Makefile, README, .pg grammar, a -harness.pir that executes the parser on a sample string and dumps the parse tree and a -stress.pir that runs 50,000 trial runs to

Re: Wikipedia example

2006-10-03 Thread Markus Triska
Aaron Sherman writes: > +Written in 2006 by Aaron Sherman, and distrbuted Typo: distributed

Re: Emacs/vim code coda placement

2006-10-03 Thread Will Coleda
On Oct 3, 2006, at 2:49 AM, Chris Dolan wrote: On Oct 3, 2006, at 1:29 AM, Paul Cochrane wrote: Hi all, In the process of trying to finish off the perl coda cage task, I notice that the Perl::Critic policy for the emacs/vim coda skips __END__ and __DATA__ sections at the end of perl files, h

Re: Nested statement modifiers.

2006-10-03 Thread Paul Seamons
> It relates to some old problems in the early part of the RFC/Apocalypse > process, and the fact that: > > say $_ for 1..10 for 1..10 > > Was ambiguous. The bottom line was that you needed to define your > parameter name for that to work, and defining a parameter name on a > modifier means t

Re: Nested statement modifiers.

2006-10-03 Thread Aaron Sherman
Paul Seamons wrote: It relates to some old problems in the early part of the RFC/Apocalypse process, and the fact that: say $_ for 1..10 for 1..10 Was ambiguous. The bottom line was that you needed to define your parameter name for that to work, and defining a parameter name on a modifi

Re: Nested statement modifiers.

2006-10-03 Thread Juerd
Aaron Sherman skribis 2006-10-03 13:46 (-0400): > In Perl 6, that's simplified to: > {{say 1 if 1}.() if 1}.() if 1; Which can also be written as: do { do { say 1 if 1 } if 1 } if 1; Which if crammed together the way you wrote it, turns into: do {do {say 1 if 1} if 1} if 1; Or perhap

Re: Nested statement modifiers.

2006-10-03 Thread Damian Conway
Juerd wrote: Which can also be written as: do { do { say 1 if 1 } if 1 } if 1; Sorry, no it can't. From S4 (http://dev.perl.org/perl6/doc/design/syn/S04.html#The_repeat_statement): "Unlike in Perl 5, applying a statement modifier to a do block is specifically disallowed Which if

Re: Nested statement modifiers.

2006-10-03 Thread Damian Conway
[Apologies for the last post. Gmail got a little eager. Here's what I meant to send...] Juerd wrote: Which can also be written as: do { do { say 1 if 1 } if 1 } if 1; Sorry, no it can't. From S4 (http://dev.perl.org/perl6/doc/design/syn/S04.html#The_repeat_statement): "Unlike in Pe

Re: Nested statement modifiers.

2006-10-03 Thread Audrey Tang
在 Oct 4, 2006 7:46 AM 時,Damian Conway 寫到: [Apologies for the last post. Gmail got a little eager. Here's what I meant to send...] Juerd wrote: Which can also be written as: do { do { say 1 if 1 } if 1 } if 1; Sorry, no it can't. From S4 (http://dev.perl.org/perl6/doc/design/syn/ S04

Re: Nested statement modifiers.

2006-10-03 Thread Damian Conway
Audrey asked: > However, I wonder if this is too strict. Disallowing "while" and > "until" after a do block is fine (and can be coded directly in those > two statement modifier macros), but is there a reason to disallow > other modifiers? Well, for a start, there's this syntactic problem: do

Re: Nested statement modifiers.

2006-10-03 Thread Audrey Tang
在 Oct 4, 2006 10:17 AM 時,Damian Conway 寫到: Audrey asked: However, I wonder if this is too strict. Disallowing "while" and "until" after a do block is fine (and can be coded directly in those two statement modifier macros), but is there a reason to disallow other modifiers? Well, for a start

Re: Nested statement modifiers.

2006-10-03 Thread Damian Conway
The use case here is do { .foo for @bar } if $baz; But I guess you can always "protect" it with a parens: (do { .foo for @bar }) if $baz; Or just: if $baz { .foo for @bar } or even: @bar».foo if $baz; ;-) Damian