Michael G Schwern:
# You can do it with a map without much trouble:
#
# my @indexes = map { /condition/ ? $i++ : () } @stuff;
Unless I'm mistaken, that won't work, since $i only gets incremented on
matches. I think this:
my @indexes = map { $i++; /condition/ ? $i : () } @stuff;
From: Brent Dax [EMAIL PROTECTED]
Date: Thu, 5 Dec 2002 00:28:52 -0800
Michael G Schwern:
# You can do it with a map without much trouble:
#
# my @indexes = map { /condition/ ? $i++ : () } @stuff;
Unless I'm mistaken, that won't work, since $i only gets incremented on
matches. I
On 12/04/2002 3:21 PM, Larry Wall wrote:
On Wed, Dec 04, 2002 at 11:38:35AM -0800, Michael Lazzaro wrote:
: We still need to verify whether we can have, in qq strings:
:
:\033 - octal (p5; deprecated but allowed in p6?)
I think it's disallowed.
Thank the many gods ... or One True
[EMAIL PROTECTED] (Miko O'Sullivan) writes:
FWIW, I came up with purge because my first inclination was to spell
grep backwards: perg. :-)
For reference, Ruby uses .detect and .reject.
--
3rd Law of Computing:
Anything that can go wr
fortune: Segmentation violation -- Core dumped
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Date: Thu, 5 Dec 2002 02:45:39 -0800
From: Michael G Schwern [EMAIL PROTECTED]
Content-Disposition: inline
Sender: Michael G Schwern [EMAIL PROTECTED]
X-SMTPD: qpsmtpd/0.12, http://develooper.com/code/qpsmtpd/
I'm going to ask something
On Thu 05 Dec, Michael G Schwern wrote:
So here's your essay topic:
Explain how having indexes (arrays, substr, etc...) in Perl 6 start at 0
will benefit most users. Do not invoke legacy. [1]
[1] ie. because that's how most other languages do it or everyone is
used to it by now are not
Michael G Schwern writes:
I'd love to be able to do it with a grep like thing.
(@switches, @args) = seperate /^-/, @ARGV;
Yes. I've written that function in Perl 5, which isn't ideal, because you
have to return array refs, not arrays.
However, I don't think it should be called
Aaron Crane:
However, I don't think it should be called 'seperate'. I also don't think
it should be called 'separate', because that word seems to be commonly
misspelled...
That seems like an excellent argument for calling it 'separate'. Perhaps it
will be the first of many spelling-improving
Michael G Schwern wrote:
and that's just entirely too much work. I'd love to be able to do
it with a grep like thing.
(@switches, @args) = seperate /^-/, @ARGV;
seperate() simply returns two lists. One of elements which match,
one of elements which don't. I think Perl 6 will allow
Angel Faus:
Maybe the solution is to make it hash-wise:
%hash = @array.sep {
when /^[A-Z]*$/ {'uppercase'}
when /^[a-z]*$/ {'lowercase'}
default {'mixedcase'}
}
I agree that general partitioning is 'better' than a fixed binary proposal,
but what is gained
Explain how having indexes (arrays, substr, etc...) in Perl 6 start
at 0 will benefit most users.
The languages which do not start their indices at 0 are dead or dying.
Do not invoke legacy.
How about FUD? :-)
=Austin
--- Michael G Schwern [EMAIL PROTECTED] wrote:
I'm going to ask
In thinking about how to write a partition function (or separate, or
whatever you want to call it) it occurs to me that you might want some
sort of reverse-varargs behavior, like
my (@a, @b, @c, @d) = @array.partiton { $_ % 4 };
So in this case, partition is supposed to determine, on the fly,
On Thursday, December 5, 2002, at 02:11 AM, James Mastros wrote:
On 12/04/2002 3:21 PM, Larry Wall wrote:
\x and \o are then just shortcuts.
Can we please also have \0 as a shortcut for \0x0?
\0 in addition to \x, meaning the same thing? I think that would get
us back to where we were
On Wednesday, December 4, 2002, at 12:55 PM, David Whipp wrote:
How far can we go with this \c thing? How about:
print \c[72, 101, 108, 108, 111];
will that print Hello?
Huh... having a comma-separated list to represent multiple characters.
I can't think of any problems with that, and it
On Wednesday, December 4, 2002, at 09:11 PM, John Williams wrote:
On Wed, 4 Dec 2002, Miko O'Sullivan wrote:
FWIW, I came up with purge because my first inclination was to spell
grep backwards: perg. :-)
While purge is cute, it certainly is not obvious what it does. Of
course neither is
On Thu, Dec 05, 2002 at 09:18:21AM -0800, Michael Lazzaro wrote:
:
: On Thursday, December 5, 2002, at 02:11 AM, James Mastros wrote:
:
: On 12/04/2002 3:21 PM, Larry Wall wrote:
: \x and \o are then just shortcuts.
: Can we please also have \0 as a shortcut for \0x0?
:
: \0 in addition to \x,
I like it except for the name, which feels too active to me (ie, if I were to
purge those elements from the array I'd expect the array to be altered, instead
of returning a new array with only those elements). But I do like the idea. I
think the name except would be pretty nice, though. Then
On Wed, 4 Dec 2002, John Williams wrote:
While purge is cute, it certainly is not obvious what it does. Of
course neither is grep unless you are an aging unix guru...
How about something which is at least obvious to someone who knows what
grep is, such as vgrep or grep:v?
How about my
How about my original inclinaton: perg? It just screams out the
opposite of grep.
So it greps a list in reverse order?
-R (who does not see any benefit of 'perg' over grep { ! code } )
On Thu, 5 Dec 2002, Robert Spier wrote:
-R (who does not see any benefit of 'perg' over grep { ! code } )
My problem with grep { ! code } is the same problem I have with if (!
expression): I've never developed a real trust in operator precedence.
Even looking at your pseudocode example, I
On Thursday, December 5, 2002, at 10:09 AM, Michael Lazzaro wrote:
What about divvy (or are we already using that for something else?)
my(@a,@b) = divvy { ... } @c;
Other possibilities from the ol' thesaurus: Callot, Cdeal,
Cdole, Cdispense.
@$#@%*. Trying to do too many %#@%@ things
On Thu, Dec 05, 2002 at 10:09:08AM -0800, Michael Lazzaro wrote:
: What about divvy (or are we already using that for something else?)
:
: my(@a,@b) = divvy { ... } @c;
Any such solution must use := rather than =. I'd go as far as to say
that divvy should be illegal in a list context.
Note
Larry Wall [EMAIL PROTECTED] wrote:
On Thu, Dec 05, 2002 at 10:09:08AM -0800, Michael Lazzaro wrote:
: What about divvy (or are we already using that for something else?)
:
: my(@a,@b) = divvy { ... } @c;
Any such solution must use := rather than =. I'd go as far as to say
that divvy
FWIW, I came up with purge because my first inclination was to spell
grep backwards: perg. :-)
I like purge, although except, exclude, and omit all have their
charms.
For partition function, I like divvy, carve, segment (in that order)
and almost anything other than separate, which IIRC is
On Thu, 5 Dec 2002, Dave Whipp wrote:
Only if we apply a bit of magic (2 is a true value). The rule might be:
How about if we just have two different methods: one for boolean and one
for multiple divvies:
my(@true, @false) := @array.cull{/some test/};
my (@a, @b, @c) := @array.divvy{some
John Williams wrote in perl.perl6.language :
While purge is cute, it certainly is not obvious what it does. Of
course neither is grep unless you are an aging unix guru...
How about something which is at least obvious to someone who knows what
grep is, such as vgrep or grep:v?
If you want
Miko O'Sullivan [EMAIL PROTECTED] wrote:
On Thu, 5 Dec 2002, Dave Whipp wrote:
Only if we apply a bit of magic (2 is a true value). The rule might be:
How about if we just have two different methods: one for boolean and one
for multiple divvies:
my(@true, @false) := @array.cull{/some
On Thursday, December 5, 2002, at 07:53 AM, Austin Hastings wrote:
And in general, without resorting to something hideous like scanf, is
there going to be some more-advanced want() variant that allows saying
@a, $i, $j, @b, %w, $k, @c = scramble(...);
This is a terribly important question,
On 5 Dec 2002, Rafael Garcia-Suarez wrote:
If you want good'ol Unix flavor, call it vrep. Compare the ed(1) /
ex(1) / vi(1) commands (where 're' stands for regular expression, of
course) :
:g/re/p
:v/re/p
I like it. Fits in with our Un*x heritage, and doesn't have any existing
--- Dave Whipp [EMAIL PROTECTED] wrote:
I think that ccull would be an abysmal name: that implies
keep the false ones. I'm not sure that there is a synonym
for boolean partition though. Perhaps we need some help
from a linguist! ;)
What's wrong with split()?
split { f($_) }, $iterator
A big issue that still remains with literals is the stringification of
objects and references. In an effort to get the behaviors hammered
down, here are a few ideas:
First off, references:
By default, references should not stringify to anything pretty, they
should stringifiy to something useful
Joseph F. Ryan:
# By default, references should not stringify to anything
# pretty, they should stringifiy to something useful for
# debugging. Heck, even perl5 style should be fine. Not only
Why? Isn't the pretty form more generally useful?
# is this handy, but also prevents problems with
I would suggest that we could get away with a single n-ary built-in.
And I would strongly suggest that Cdivvy isn't the right name for it,
since, apart from being a ugly, slang word, divvy implies dividing up
equally. The built-in would actually be doing classification of the
elements of the
Brent Dax wrote:
Joseph F. Ryan:
# By default, references should not stringify to anything
# pretty, they should stringifiy to something useful for
# debugging. Heck, even perl5 style should be fine. Not only
Why? Isn't the pretty form more generally useful?
I don't think so; I'd think
34 matches
Mail list logo