Re: IMCC and locals/lexicals

2002-12-07 Thread Leopold Toetsch
[EMAIL PROTECTED] wrote: ... this seemed reasonable, but it doesn't help: .sub _foo .local int x x = 5 .namespace ANON .local int x x = 3 print x .endnamespace ANON print x .end All untested features are b0rken. I got namespace now running, above snippet be

Re: logical_not issue

2002-12-07 Thread Nicholas Clark
On Fri, Dec 06, 2002 at 05:01:21PM -0500, Dan Sugalski wrote: > It is OK for an undef value to be true, though. That's not only > allowable, it has to be allowed. For perl, at least, it's how Larry > plans on getting around the "function returns undef, but it's a real > undef value, not a false

Re: purge: opposite of grep

2002-12-07 Thread Michael Lazzaro
Damian Conway wrote: > > Michael Lazzaro wrote: > > > How would you do something like: > > > > (@foo,@bar,@zap) := classify { /foo/ ;; /bar/ ;; /zap/ } @source; > > Since I don't understand what that's supposed to do, I probably *wouldn't* > do something like it. What effect are you trying t

Re: purge: opposite of grep

2002-12-07 Thread Damian Conway
Michael Lazzaro wrote: (@foo,@bar,@zap) := classify { /foo/ ;; /bar/ ;; /zap/ } @source; A shorthand ... that "classifies" (or "parts") @source according to > the results of a series of tests, not just one. You mean, like: (@foo,@bar,@zap) := part { when /foo/ {0}; when /bar/ {1}; when

Re: purge: opposite of grep

2002-12-07 Thread Ken Fox
Michael Lazzaro wrote: (@foo,@bar,@zap) := classify { /foo/ ;; /bar/ ;; /zap/ } @source; A shorthand for: for @source { given { when /foo/ { push @foo, $_ } when /bar/ { push @bar, $_ } when /zap/ { push @zap, $_ } } } How about just (@foo,@bar,@

Re: Usage of \[oxdb]

2002-12-07 Thread Nicholas Clark
On Sat, Dec 07, 2002 at 01:20:26PM +1100, Damian Conway wrote: > Nicholas Clark mused: > > >I just had this thought - can I interpolate in there? > > > >Something like > >"\c[$(call_a_func())]" > > Why not just: > > "$(chr call_a_func()]" > > ??? Well, I was wondering if my function returned

Re: purge: opposite of grep

2002-12-07 Thread Michael Lazzaro
Damian Conway wrote: > or even a arrayed form, when the corresponding index was implicit: > > (@foo,@bar,@zap) := part [/foo/, /bar/, /zap/], @source; That's kinda nifty. But admittedly, it's not to-die-for necessary, if I'm the only one fond of it. Ken Fox wrote: > and implement class

Re: purge: opposite of grep

2002-12-07 Thread Tanton Gibbs
> Damian Conway wrote: > > or even a arrayed form, when the corresponding index was implicit: > > > > (@foo,@bar,@zap) := part [/foo/, /bar/, /zap/], @source; > > That's kinda nifty. But admittedly, it's not to-die-for necessary, if > I'm the only one fond of it. I think this makes a nice

Re: purge: opposite of grep

2002-12-07 Thread Damian Conway
Ken Fox asked: How about just (@foo,@bar,@zap) := classify [ rx/foo/, rx/bar/, rx/zap/ ] @source; and implement classify as a normal sub? We could certainly do that. But let's call it C. Et voilĂ : sub part ($classifier, *@list) { my &classify := convert_to_sub($classifier); my

Re: purge: opposite of grep

2002-12-07 Thread Damian Conway
Damian Conway wrote: Et voilĂ : Or, of those who prefer their code sanely formatted: sub part ($classifier, *@list) { my &classify := convert_to_sub($classifier); my @parts; for @list -> $nextval { my $index = try{ classify($nextval) } // next;

Re: purge: opposite of grep

2002-12-07 Thread Simon Cozens
[EMAIL PROTECTED] (Damian Conway) writes: > > Why does everything have to be built into the first version of Perl 6? > > Everything doesn't. Everything shouldn't be. Just the really common, > important stuff. > > I have to confess though, there are *many* times I've wished for > this particular

Re: purge: opposite of grep

2002-12-07 Thread Me
> push (/foo/ && @foo || > /bar/ && @bar || > /zap/ && @zap), $_ for @source; Presumably, to avoid run time errors, that would need to be something like: push (/foo/ && @foo || /bar/ && @bar || /zap/ && @zap || @void), $_ for @source; > But perhaps... > >

Re: purge: opposite of grep

2002-12-07 Thread Damian Conway
Simon Cozens wrote: A categorise method would be just grand, and I think it should be shipped with the default Perl 6 array classes, but Perl 6 The Core Language wouldn't need to know about that particular method if it didn't want to. Err. Since arrays are core to Perl 6, how could their method

Re: purge: opposite of grep

2002-12-07 Thread Damian Conway
ralph wrote: Presumably, to avoid run time errors, that would need to be something like: push (/foo/ && @foo || /bar/ && @bar || /zap/ && @zap || @void), $_ for @source; True. Why not: part ( @source, /foo/ => @foo, /bar/ => @bar, /zap/ => @zap ); Because C, C,

Re: purge: opposite of grep

2002-12-07 Thread Michael Lazzaro
Damian Conway wrote: > (@foo,@bar,@zap) := part [/foo/, /bar/, /zap/], @source; If we're worried about the distance between the source and destination when there are many tests, maybe: part { /foo/ => @foo, /bar/ => @bar, /zap/ => @zap }, @source; Or, 'long' formatted: part {

IMCC and constants?

2002-12-07 Thread gregor
Leo -- Here's the simple bench.jako example (again): const int N = 100; var int q = 1; while (q < N) { var int i, j, w = 1; while (w < N) { i++; j += i; w++; #print("$q, $w\n"); } q++; } I used to work harder in the Jako compiler to track constants and substitute the

Re: purge: opposite of grep

2002-12-07 Thread Damian Conway
Michael Lazzaro wrote: If we're worried about the distance between the source and destination when there are many tests Are we? I'm not. maybe: part { /foo/ => @foo, /bar/ => @bar, /zap/ => @zap }, @source; Or, 'long' formatted: part { /foo/ => @foo, /bar/ => @bar,

Re: Usage of \[oxdb]

2002-12-07 Thread Damian Conway
Nicholas Clark wrote: Why not just: "$(chr call_a_func()]" ??? Well, I was wondering if my function returned "CR", then "\c[$(call_a_func())]" would mean that the "CR" gets run thought the \c[...] conversion and a single byte ("\r") is what ends up in the string. I seriously doubt it. %-)

Re: purge: opposite of grep

2002-12-07 Thread Damian Conway
Ian Remmler decloaked and wrote: I'm not sure the meaning of the name C would be obvious > to someone who hadn't seen it before. What, as opposed to C or C or C or C or C or C or C or C or C or C or C or C or C or...? ;-) I keep thinking C would be nice, or maybe C. Just a thought... C i