How would I do this in Perl6? #1

2004-09-14 Thread Michele Dondi
Dear all, I've recently thought of a possible syntax extension for (Perl5's) [un]pack() and I posted my RFC to clpmisc where it didn't have much success, I must say. However I'm not interested in proposing it here, only I would like to investigate a possible Perl6 technique inspired by those

But is it intuitive?

2004-09-14 Thread Austin Hastings
I was thinking about removing files this morning, and realized that I wish rm supported inclusion/exclusion. In particular, I wanted to remove * but not Makefile (since my Makefile uses lwp-download to re-fetch the source code, etc.) It occurred to me to wonder: can P6's cbut do the same

Re: But is it intuitive?

2004-09-14 Thread Abhijit Mahabal
On Tue, 14 Sep 2004, Austin Hastings wrote: I was thinking about removing files this morning, and realized that I wish rm supported inclusion/exclusion. In particular, I wanted to remove * but not Makefile (since my Makefile uses lwp-download to re-fetch the source code, etc.) It occurred

Re: But is it intuitive?

2004-09-14 Thread Mark J. Reed
On 2004-09-14 at 08:40:55, Austin Hastings wrote: In particular, I wanted to remove * but not Makefile (since my Makefile uses lwp-download to re-fetch the source code, etc.) Well, you can, depending on your shell: in ksh: rm !(Makefile) in bash: ditto, but you have to turn on the extglob

Re: Current state?

2004-09-14 Thread James Mastros
Patrick R. Michaud wrote: On Wed, Sep 08, 2004 at 09:56:12AM -0700, Larry Wall wrote: On Wed, Sep 08, 2004 at 07:33:45AM -0600, Patrick R. Michaud wrote: : We're in the beginning stages of building a basic perl 6 grammar engine : (i.e., probably without p6 closures) that compiles to parrot and

Re: Current state?

2004-09-14 Thread Jonathan Scott Duff
On Tue, Sep 14, 2004 at 04:03:49PM +0200, James Mastros wrote: Or, instead of thinking of this as a special-purpose thing, consider rules to be a sepperate language from perl, mostly independent of it, and the /default/ language for assertations/rules being perl, but allow a :language

Re: Namespaces

2004-09-14 Thread Jeff Clites
On Sep 13, 2004, at 1:07 AM, Luke Palmer wrote: Jeff Clites writes: On Sep 12, 2004, at 8:43 PM, Luke Palmer wrote: Jeff Clites writes: On Sep 7, 2004, at 6:26 AM, Dan Sugalski wrote: *) Namespaces are hierarchical So we can have [foo; bar; baz] for a namespace. Woo hoo and all that. It'd map to

Re: But is it intuitive?

2004-09-14 Thread Luke Palmer
Abhijit Mahabal writes: On Tue, 14 Sep 2004, Austin Hastings wrote: I was thinking about removing files this morning, and realized that I wish rm supported inclusion/exclusion. In particular, I wanted to remove * but not Makefile (since my Makefile uses lwp-download to re-fetch the

Re: Current state?

2004-09-14 Thread Larry Wall
I'd suggest looking at the t/op/re_tests file from Perl 5. It's based on the test suite that originally came with Henry Spencer's regular expression package. It would, of course, need to be translated and extended, but it contains a lot of torturous tests for the standard rx behavior. And it's

bootstrapping the grammar

2004-09-14 Thread Uri Guttman
just a few musings on bootstrapping the grammar. someone mentioned the idea of using Perl6::Rules to help with this and i think that could be a great way to go for several reasons. it will take a fair amount of time to get a new p6 rules engine (fearless leader said 1 month but i think that is

Re: But is it intuitive?

2004-09-14 Thread Austin Hastings
Luke Palmer wrote: Judging from this, maybe we ought to have :not. Anyway, it's still possible: $my_rex = rx/fo*/ none(rx/^foo$/); For sure. On a side note, there should be a negating match operator for use inside: rx/\d+/ none(rx/1984/) could get awfully long if you had to handle

Re: Current state?

2004-09-14 Thread Dan Sugalski
At 4:03 PM +0200 9/14/04, James Mastros wrote: Now for the cons: - The compilation interface doesn't have any way to be given a bunch of code that includes code in the target language in the beginning, that will consume that, then hand the rest back to us. - This means that the grammar parser

Re: But is it intuitive?

2004-09-14 Thread Aaron Sherman
On Tue, 2004-09-14 at 10:11, Abhijit Mahabal wrote: On Tue, 14 Sep 2004, Austin Hastings wrote: That is, can I say: $my_rex = qr/fo*/ but not 'foo'; The word junction came to my mind as I read your mail. $my_rex = qr/fo*/ qr:not/foo/; Of course, the regex itself can do this:

Re: bootstrapping the grammar

2004-09-14 Thread Sean O'Rourke
At Tue, 14 Sep 2004 12:31:44 -0400, Uri Guttman [EMAIL PROTECTED] wrote: just a few musings on bootstrapping the grammar. someone mentioned the idea of using Perl6::Rules to help with this and i think that could be a great way to go for several reasons. FWIW, this was the idea motivating

Re: How would I do this in Perl6? #1

2004-09-14 Thread Aaron Sherman
On Tue, 2004-09-14 at 06:45, Michele Dondi wrote: [... snip ...] Now I want to take a list of templates, say $t1, ... $tn and get the result of $result = pack $tn, ... pack $t2, pack $t1, @input; Assuming Perl 6 has a pack, which it may not: for @t { $result =

Re: But is it intuitive?

2004-09-14 Thread Juerd
Aaron Sherman skribis 2004-09-14 14:02 (-0400): qr{(fo*) ({$1 ne 'foo'})} What is the second set of parens for? Will the following suffice? rx/ (fo*) { $1 ne 'foo' } / And it is because of the lack of anchors that this won't work as expected? rx/ !before foo fo* / Juerd

Re: But is it intuitive?

2004-09-14 Thread Larry Wall
On Tue, Sep 14, 2004 at 02:02:22PM -0400, Aaron Sherman wrote: : Of course, the regex itself can do this: : : qr{(fo*) ({$1 ne 'foo'})} Er, at the moment bare closures don't care about their return value, so as it currently stands, you'd want something more like: rx/(fo*) {fail if $1

Re: But is it intuitive?

2004-09-14 Thread Larry Wall
On Tue, Sep 14, 2004 at 08:30:45PM +0200, Juerd wrote: : Aaron Sherman skribis 2004-09-14 14:02 (-0400): : qr{(fo*) ({$1 ne 'foo'})} : : What is the second set of parens for? Will the following suffice? : : rx/ (fo*) { $1 ne 'foo' } / Bare closures are used only for their side effects

Re: Current state?

2004-09-14 Thread Patrick R. Michaud
On Tue, Sep 14, 2004 at 04:03:49PM +0200, James Mastros wrote: Or, instead of thinking of this as a special-purpose thing, consider rules to be a sepperate language from perl, mostly independent of it, and the /default/ language for assertations/rules being perl, but allow a :language

Re: Current state?

2004-09-14 Thread Patrick R. Michaud
On Tue, Sep 14, 2004 at 08:43:08AM -0700, Larry Wall wrote: I'd suggest looking at the t/op/re_tests file from Perl 5. It's based on the test suite that originally came with Henry Spencer's regular expression package. It would, of course, need to be translated and extended, but it contains a

Re: Current state?

2004-09-14 Thread James Mastros
Jonathan Scott Duff wrote: On Tue, Sep 14, 2004 at 04:03:49PM +0200, James Mastros wrote: Or, instead of thinking of this as a special-purpose thing I think you meant something akin to C /(.) { use PIR; print P0;}/ and C /(.) { use Forth; P0 print}/ :-) As long as we're special-casing things

Re: Current state?

2004-09-14 Thread Jonathan Scott Duff
On Tue, Sep 14, 2004 at 08:13:13PM +0200, James Mastros wrote: Jonathan Scott Duff wrote: On Tue, Sep 14, 2004 at 04:03:49PM +0200, James Mastros wrote: Or, instead of thinking of this as a special-purpose thing I think you meant something akin to C /(.) { use PIR; print P0;}/ and C /(.) {

Re: Current state?

2004-09-14 Thread Larry Wall
On Tue, Sep 14, 2004 at 08:13:13PM +0200, James Mastros wrote: : Of course, this is really language design -- Larry, you listening? Sure, I'm listening, but what's the point when I agree with everyone. :-) I agree that the default should be the current outer language. I agree that the default

Re: Current state?

2004-09-14 Thread Patrick R. Michaud
On Tue, Sep 14, 2004 at 12:42:59PM -0700, Larry Wall wrote: : Of course, this is really language design -- Larry, you listening? Sure, I'm listening, but what's the point when I agree with everyone. :-) I agree that the default should be the current outer language. I agree that the

Re: Current state?

2004-09-14 Thread Dan Sugalski
At 8:13 PM +0200 9/14/04, James Mastros wrote: Instead of looking to introduce a hack, look to figure out how we can fit this ability into the design of rules. Instead of { ... } just containing perl6 code, we need a way to signal that it's not perl6 code. How about... it brackets code in the

Re: But is it intuitive?

2004-09-14 Thread Aaron Sherman
On Tue, 2004-09-14 at 14:40, Larry Wall wrote: On Tue, Sep 14, 2004 at 02:02:22PM -0400, Aaron Sherman wrote: : Of course, the regex itself can do this: : : qr{(fo*) ({$1 ne 'foo'})} Er, at the moment bare closures don't care about their return value, so as it currently stands, you'd

Re: How would I do this in Perl6? #1

2004-09-14 Thread Michele Dondi
On Tue, 14 Sep 2004, Aaron Sherman wrote: Assuming Perl 6 has a pack, which it may not: I know: this is one of the reasons why I wrote (hopefully *clearly* enough) that I was just using it as an example. A user defined pack() whoud do just the same here, anyway. for @t {

Re: Current state?

2004-09-14 Thread JOSEPH RYAN
- Original Message - From: Patrick R. Michaud [EMAIL PROTECTED] Date: Tuesday, September 14, 2004 3:56 pm Subject: Re: Current state? On Tue, Sep 14, 2004 at 12:42:59PM -0700, Larry Wall wrote: : Of course, this is really language design -- Larry, you listening? Sure, I'm

Re: Current state?

2004-09-14 Thread hv
Patrick R. Michaud [EMAIL PROTECTED] wrote: :How does p5 do it? Brokenly. It looks for balanced curlies unintelligently; try: perl -we '/(?{ }) })/' I'd expect p6 rules to be parsed using a grammar, and within such a context to invoke the 'closure' rule; it's that rule that'd have the

Re: How would I do this in Perl6? #1

2004-09-14 Thread Larry Wall
On Tue, Sep 14, 2004 at 12:45:17PM +0200, Michele Dondi wrote: : To my knowledge and great : pleasure Perl6 will support currying and a builtin reduce/fold operator. : : So what I would like to do is (i) Cmap the list of templates to a list : of curried closures in which the first parameter is

Re: How would I do this in Perl6? #1

2004-09-14 Thread Matt Diephouse
On Tue, 14 Sep 2004 12:45:17 +0200 (CEST), Michele Dondi [EMAIL PROTECTED] wrote: Now I want to take a list of templates, say $t1, ... $tn and get the result of $result = pack $tn, ... pack $t2, pack $t1, @input; without actually writing the whole thing. To my knowledge and great