hcchien raised the following question on #perl6[1]:
If I want to loop through a nine-element array three elements at a time, I do
my @a = 1..9;
for @a - $x, $y, $z { say $x }
But what if I don't care about the elements 1,4,7? Would the following
be a sane syntax?
my @a = 1..9;
for @a - undef,
On 9/22/05, Carl Mäsak [EMAIL PROTECTED] wrote:
FWIW, to me it looks fairly intuitive. undef here means don't alias
the element, just throw it away... gaal joked about using _ instead
of undef. :)
Joked? Every other language that has pattern matching signatures that
I know of (that is, ML
Mark A. Biggar skribis 2005-09-21 17:44 (-0700):
Now for a related question: is it intended that ~$x and +$n be the same
as $x.as(Str) and $x.as(Num)? How locked in stone would this be, I.e.,
~ and + are macros that give the .as() form?
If I read everything correctly, this is the case.
Stuart Cook skribis 2005-09-22 10:39 (+1000):
If there's no (single) obvious interpretation of turn a value into a
number for a particular type, then don't struggle to come up with a
non-obvious one--I say just leave it undefined, or have it fail(), or
whatever.
Leaving it undefined is wrong
On Wed, 21 Sep 2005, Joshua Gatcomb wrote:
I have mocked up an example of how you could do this in p5 with some ugly
looking code:
You may be interested to know that this has had an echo at
http://www.perlmonks.org/index.pl?node_id=493826
mostly misunderstood in the replies, IMHO. Basically
On Wed, 21 Sep 2005, Joshua Gatcomb wrote:
Cheers,
Joshua Gatcomb
a.k.a. Limbic~Region
Oops... I hadn't noticed that you ARE L~R...
Michele
--
Your ideas about Cantorian set theory being awful suffer from the
serious defect of having no mathematical content.
- Torkel Franzen in sci.math,
Michele Dondi wrote:
On Wed, 21 Sep 2005, Joshua Gatcomb wrote:
Cheers,
Joshua Gatcomb
a.k.a. Limbic~Region
Oops... I hadn't noticed that you ARE L~R...
In the tradition of i18n, etc., I had assumed that L~R was shorthand for
Luke Palmer. You may want to keep up the old tradition of
Eric wrote:
Since you wouldn't expect an object to stringify or numify...
You wouldn't??! I certainly would.
Object references already stringify/numerify/boolify in Perl 5. Unfortunately,
they do so with problematic default behaviours, which is why Cuse overload
allows you to overload q{},
Excuse my noobness, I really have no idea about any of the inner workings,
but am just concerned with a more elegant syntax of doing it.
How about something like:
if ($condition) {
pre;
always { # maybe uncond instead of always, or both -- always could
# mean 'ignore all conditions' and uncond
Ingo Blechschmidt asked:
my $pair = (a = 42);
say ~$pair; # a\t42? a\t42\n? a 42?
Not yet specified but I believe it should be 42 (i.e. stringifies to value).
Note that S02 does specify that pairs *interpolate* to key-tab-val-newline,
so you can still get a\t42\n by writing $pair
On 22/09/05, Shane Calimlim [EMAIL PROTECTED] wrote:
How about something like:
if ($condition) {
pre;
always { # maybe uncond instead of always, or both -- always could
# mean 'ignore all conditions' and uncond could mean
# 'ignore the current block's condition
mid_section;
}
post;
}
On Sep 22, 2005, at 3:08 AM, Luke Palmer wrote:
On 9/22/05, Carl Mäsak [EMAIL PROTECTED] wrote:
FWIW, to me it looks fairly intuitive. undef here means don't alias
the element, just throw it away... gaal joked about using _ instead
of undef. :)
Joked? Every other language that has
Both recently discussed situations with blocks can be solved by
introducing a way to leave the current block and resume it elsewhere.
I'll demonstrate it assuming there is a pause/cont combination. For
these examples to work, pause needs to take effect after the entire
statement it's in is
Damian Conway skribis 2005-09-22 8:20 (+1000):
Note that S02 does specify that pairs *interpolate* to
key-tab-val-newline, so you can still get a\t42\n by writing $pair
instead.
I think separating stringification and interpolation leads to
unpredictability, and is a very bad thing.
Juerd
--
HaloO,
Carl Mäsak wrote:
But what if I don't care about the elements 1,4,7? Would the following
be a sane syntax?
my @a = 1..9;
for @a - undef, $x, $y { say $x }
I think that, if the concept of lazy list evaluation is running
deep in Perl 6 than the obvious solution to me is:
for @a - $x,
HaloO,
Juerd wrote:
Both recently discussed situations with blocks can be solved by
introducing a way to leave the current block and resume it elsewhere.
With first class code types, _ and label beeing bound lexically
to the current instance of the sub class, the set of current control
flow
On Thu, Sep 22, 2005 at 07:23:06 -0400, David Storrs wrote:
On Sep 22, 2005, at 3:08 AM, Luke Palmer wrote:
On 9/22/05, Carl Mäsak [EMAIL PROTECTED] wrote:
FWIW, to me it looks fairly intuitive. undef here means don't alias
the element, just throw it away... gaal joked about using _
On Wed, Sep 21, 2005 at 13:53:20 +0200, TSa wrote:
HaloO Yuval,
you wrote:
On Mon, Aug 29, 2005 at 14:07:51 +0200, TSa wrote:
role Object does Compare[Object, =:=]
role Numdoes Compare[Num, ==]
role Strdoes Compare[Str, eq]
What is the implication of from the perspective of
Yuval~
On 9/22/05, Yuval Kogman [EMAIL PROTECTED] wrote:
On Thu, Sep 22, 2005 at 08:20:42 +1000, Damian Conway wrote:
Ingo Blechschmidt asked:
my $pair = (a = 42);
say ~$pair; # a\t42? a\t42\n? a 42?
Not yet specified but I believe it should be 42 (i.e. stringifies to
HaloO,
Yuval Kogman wrote:
No, the role installs homogenious targets into the generic
binary-MMD comparator which I think is called eqv.
Err, why? We already have that with regular MMD semantics.
role Num {
multi *infix:eqv ($x:, Num $y) { $x == $y }
}
What you mean is double
TSa skribis 2005-09-22 14:55 (+0200):
Why not simply:
loopbody:
Because I don't like non-block labels. It reminds me too much of
bad-goto.
This, and I fear this would have bad performance. That's based on
nothing, though.
And I hope we all agree, that goto behind the scenes is
not a
21 matches
Mail list logo