Larry Wall wrote:
: my $b <== foo();
:
: declares $b to be an iterator rather than an array ref.
Though that would seem to imply that *$x slurpy parameters should
work that way too, and that's not how they work right now...
This is very in line with my current conclusion that List is
a s
On Tue, May 31, 2005 at 03:42:42PM -0700, Larry Wall wrote:
: On Wed, May 25, 2005 at 07:07:02PM -0400, Uri Guttman wrote:
: : the only advantage in the above case is the different prececences of =
: : and <== which allows dropping of parens with the latter. i don't
: : consider that so important a
On Wed, May 25, 2005 at 07:07:02PM -0400, Uri Guttman wrote:
: the only advantage in the above case is the different prececences of =
: and <== which allows dropping of parens with the latter. i don't
: consider that so important a win as to be used often. and they are at
: equal huffman levels as
HaloO Juerd,
you wrote:
Because the alternative is to drop context.
...
Then we lose the point for having different sigils, and everything gets
a dollar sign.
Isn't the strong type system adequate compensation?
Especially when the sigils denote the level below
which you can't go in untypedness
"TSa (Thomas Sandlaß)" skribis 2005-05-27 15:44 (+0200):
> Could the ones who know it, enlighten me *why* it has to be so?
> What does it buy the newbie, average, expert Perl6 programmer?
> The answer "that's how Perl5 did it" is a good default, but
> never hindered @Larry to change things.
Becaus
"TSa (Thomas Sandlaß)" skribis 2005-05-27 16:22 (+0200):
> This argumentation breaks down as soon as you regard &infix:{'='} as
> an operator like many others.
Which we don't, making this discussion much easier for everyone.
Juerd
--
http://convolution.nl/maak_juerd_blij.html
http://convolutio
Juerd wrote:
And, assigning to a reference is impossible, as a reference is a VALUE,
not a VARIABLE (container).
What should hinder &infix:{'='}:(Ref, Int: --> Int) to exist and be
usefull at least if the Ref is known to something that derefs it
and then finds the new referee? On the Perl6 lang
Juerd wrote:
From S02: "Array and hash variable names in scalar context
automatically produce references."
Since [...] produces a scalar arrayref, we end up with an arrayref one
both sides of the =.
No.
There is no scalar context on the LHS of the assignment operator.
And, assigning to a re
Markus Laire wrote:
@m[0;1] is a multidim deref, referencing the 4.
Referencing the 2, I hope?
Doh!
Yes, the 2.
Really?
I consider this puzzling indicative that the (,) vs. [,] distinction
in Perl6 falls into the same category as e.g. starting the capture
variables at $1.
@m here has _sin
Juerd wrote:
Rod Adams skribis 2005-05-26 4:15 (-0500):
From S02: "Array and hash variable names in scalar context
automatically produce references."
Since [...] produces a scalar arrayref, we end up with an arrayref one
both sides of the =.
No.
There is no scalar context on the LH
> Is giving "=" a higher precedence than "," still considered A Good Thing?
>
> I'm not familiar with the reasoning behind the current situation, but
> I'm struggling to come up with any good reasons for keeping it.
>
> Consider the alternative:
>
> my $a, $b = 1, 2; # $b should contain 2, not 1
Rod Adams skribis 2005-05-26 4:15 (-0500):
> From S02: "Array and hash variable names in scalar context
> automatically produce references."
> Since [...] produces a scalar arrayref, we end up with an arrayref one
> both sides of the =.
No.
There is no scalar context on the LHS of the assignme
Markus Laire wrote:
Rod Adams wrote:
TSa (Thomas Sandlaß) wrote:
You mean @a = [[1,2,3]]? Which is quite what you need for multi
dimensional arrays anyway @m = [[1,2],[3,4]] and here you use
of course @m[0][1] to pull out the 2. I'm not sure if this
automatically
makes the array multi-dim
Rod Adams wrote:
Austin Hastings wrote:
--- Rod Adams <[EMAIL PROTECTED]> wrote:
TSa (Thomas Sandlaß) wrote:
@m = [[1,2],[3,4]]
@m[0;1] is a multidim deref, referencing the 4.
Referencing the 2, I hope?
Doh!
Yes, the 2.
Really?
@m here has _single_ array-ref so
@m[0] returns that si
Rod Adams wrote:
TSa (Thomas Sandlaß) wrote:
You mean @a = [[1,2,3]]? Which is quite what you need for multi
dimensional arrays anyway @m = [[1,2],[3,4]] and here you use
of course @m[0][1] to pull out the 2. I'm not sure if this automatically
makes the array multi-dimensional to the type syst
On 5/26/05, Stuart Cook <[EMAIL PROTECTED]> wrote:
> my $a, $b = 1, 2; # $b should contain 2, not 1
> my @foo = 3, 4, 5; # @foo should contain (3, 4, 5), not (list 3)
>
> What justification for the status quo could be so compelling that we
> feel the need to prevent both of these from doing the 'n
On 5/26/05, Juerd <[EMAIL PROTECTED]> wrote:
> You could, if you changed the precedence of , to be tighter than =.
>
> However, by default, = has higher precedence than ,, so that you need
> parens to override this decision: @a = (1,2,3);
Is giving "=" a higher precedence than "," still considere
> "w" == wolverian <[EMAIL PROTECTED]> writes:
w> On Wed, May 25, 2005 at 07:07:02PM -0400, Uri Guttman wrote:
>> please don't use <== for simple assignments as it will confuse too many
>> newbies and auch. it (and its sister ==>) are for pipelining ops like
>> map/grep and for forcin
On Wed, May 25, 2005 at 07:07:02PM -0400, Uri Guttman wrote:
> please don't use <== for simple assignments as it will confuse too many
> newbies and auch. it (and its sister ==>) are for pipelining ops like
> map/grep and for forcing assignment to the slurpy array arg of funcs
> (hey, i think i sai
> "w" == wolverian <[EMAIL PROTECTED]> writes:
w> On Wed, May 25, 2005 at 01:38:27PM -0500, Rod Adams wrote:
>> Or use
>>
>> @a <== 1,2,3;
w> I would just like to say that I like this idiom immensely.
w> my @foo <== 1, 2, 3;
w> reads extremely well to me, especially sinc
On Wed, May 25, 2005 at 01:38:27PM -0500, Rod Adams wrote:
> Or use
>
>@a <== 1,2,3;
I would just like to say that I like this idiom immensely.
my @foo <== 1, 2, 3;
reads extremely well to me, especially since I've always disliked the
usage of '=' as an operator with side effects. (I'm
Juerd wrote:
Mark Reed skribis 2005-05-25 14:09 (-0400):
That's not a translation. Parens, when not postfix, serve only one
purpose: group to defeat precedence. $foo and ($foo) are always the same
thing, regardless of the $foo.
So, you could then do this to make an array of size 3 in
Mark Reed skribis 2005-05-25 14:09 (-0400):
> > That's not a translation. Parens, when not postfix, serve only one
> > purpose: group to defeat precedence. $foo and ($foo) are always the same
> > thing, regardless of the $foo.
> So, you could then do this to make an array of size 3 in Perl6?
>
On 2005-05-25 13:54, "Juerd" <[EMAIL PROTECTED]> wrote:
>> 3. If you assign that to an array via something like @a = [1,2,3], I would
>> expect at least a warning and possibly a compile-time error.
>>
>> If it does work, it probably gets translated into @a = ([1,2,3]), which
>
> That's not
Mark Reed skribis 2005-05-25 10:49 (-0400):
> [1,2,3] is not an array or a list. It is a reference to an anonymous array.
> It is not 3 values; it¹s 1 value, which happens to point to a list of size
Just for accuracy: it points to an array, which is still not a list in
our jargon.
> 3. If you a
Austin Hastings wrote:
--- Rod Adams <[EMAIL PROTECTED]> wrote:
TSa (Thomas Sandlaß) wrote:
You mean @a = [[1,2,3]]? Which is quite what you need for multi
dimensional arrays anyway @m = [[1,2],[3,4]] and here you use
of course @m[0][1] to pull out the 2. I'm not sure if this
--- Rod Adams <[EMAIL PROTECTED]> wrote:
> TSa (Thomas Sandlaß) wrote:
>
> >
> > You mean @a = [[1,2,3]]? Which is quite what you need for multi
> > dimensional arrays anyway @m = [[1,2],[3,4]] and here you use
> > of course @m[0][1] to pull out the 2. I'm not sure if this
> automatically
> > mak
TSa (Thomas Sandlaß) wrote:
You mean @a = [[1,2,3]]? Which is quite what you need for multi
dimensional arrays anyway @m = [[1,2],[3,4]] and here you use
of course @m[0][1] to pull out the 2. I'm not sure if this automatically
makes the array multi-dimensional to the type system though. That is
[1,2,3] is not an array or a list. It is a reference to an anonymous array.
It is not 3 values; it¹s 1 value, which happens to point to a list of size
3. If you assign that to an array via something like @a = [1,2,3], I would
expect at least a warning and possibly a compile-time error.
If it do
Juerd wrote:
If assigning a ref to a hash uses the hashref's elements, then the same
is to be expected for an array.
Same feeling here. But I would let the array concede.
Because this behaviour is unwanted for
arrays (because you then can't assign a single arrayref anymore without
doubling t
"TSa (Thomas Sandlaß)" skribis 2005-05-25 13:53 (+0200):
> >>%a = ( a => 1, b => 2, c => 3 ) # @a = (1,2,3)
> >HASH = THREE PAIRS
> I look at it as &infix:{'='}:( Hash, List of Pair : --> Ref of Hash )
> and then try to understand how it behaves. BTW, I'm neither sure
> of the type of the second i
Juerd wrote:
If you STILL don't understand that it has nothing to do with
inconsistency or asymmetry, then please allow me to at this point give
up and stop trying to explain.
I would bewail that, because your explainations are very clear.
And it might appear different but I'm just trying to un
"TSa (Thomas Sandlaß)" skribis 2005-05-25 10:47 (+0200):
> I have understand what you mean and how you---and other p6l'er---
> derive [EMAIL PROTECTED] == 1 from @a = [1,2,3]. But allow me to regard this
> as slightly inconsistent, asymmetric or some such.
If you STILL don't understand that it has
Juerd wrote:
An array in scalar context evaluates to a reference to itself.
A hash in scalar context evaluates to a reference to itself.
An array in list context evaluates to a list of its elements.
A hash in list context evaluates to a list of its elements (as pairs).
Array context is a scal
"TSa (Thomas Sandlaß)" skribis 2005-05-19 21:06 (+0200):
> >The above is more commonly written as
> >
> >my @b = ([1,2,[3,4]);
> Assuming you meant @b = ([1,2,[3,4]]) what do the parens accomplish
> here?
Thanks for the correction. That is indeed what I meant.
The parens do absolutely nothin
Juerd wrote:
Parens and square brackets are very different things.
I know. The parens relevant here are the ones for precedence overrides.
And Comma is pretty low, so it almost always needs parens around it to
form lists. In particular it is below = and friends.
The above is more commonly written
"TSa (Thomas Sandlaß)" skribis 2005-05-18 21:54 (+0200):
> Juerd wrote:
> >>my @b = [1,2,[3,4]];
> >>is([EMAIL PROTECTED], 1, 'Array length, nested [], outer []s');
> Isn't that a bit inconvenient? To get e.g. 2 out of @b
> one has to write @b[0][1] while for $b a $b[1] suffices.
http://le
Juerd wrote:
my @b = [1,2,[3,4]];
is([EMAIL PROTECTED], 1, 'Array length, nested [], outer []s');
Isn't that a bit inconvenient? To get e.g. 2 out of @b
one has to write @b[0][1] while for $b a $b[1] suffices.
And @x = @b maintains this superficial level of indirection?
Does @x = @b
On Wed, May 11, 2005 at 06:24:38PM -0400, Aaron Sherman wrote:
: I'm confused as well. How does that play with Larry's comment:
:
:
http://groups-beta.google.com/group/perl.perl6.language/browse_frm/thread/54a1135c012b97bf/d17b4bc5ae7db058?q=list+comma&rnum=5&hl=en#d17b4bc5ae7db058
Well, that ap
On Thu, May 12, 2005 at 07:04:48AM +0800, Autrijus Tang wrote:
: Please sanity-check. :-)
Looks good to me. Though that should perhaps not be confused with sanity.
Larry
(reformatted to keep initialization with test)
Autrijus Tang skribis 2005-05-12 7:04 (+0800):
> my @a = (1,2,[3,4]);
> is([EMAIL PROTECTED], 3, 'Array length, nested []');
ok 1
> my $a = (1,2,[3,4]);
> is(+$a, 3, 'Array ref length, nested []');
ok 2
> my @b = [1,
On Wed, May 11, 2005 at 03:00:15PM -0600, Luke Palmer wrote:
> On 5/11/05, Autrijus Tang <[EMAIL PROTECTED]> wrote:
> > In a somewhat related topic:
> >
> > pugs> (1,(2,3),4)[2]
> > 4
> >
> > Because the invocant to .[] assumes a Singu
On Wed, 2005-05-11 at 17:48, Matt Fowles wrote:
> On 5/11/05, Luke Palmer <[EMAIL PROTECTED]> wrote:
> > On 5/11/05, Autrijus Tang <[EMAIL PROTECTED]> wrote:
> > > In a somewhat related topic:
> > >
> > > pugs> (1,(2,3),4)[2]
> >
All~
On 5/11/05, Luke Palmer <[EMAIL PROTECTED]> wrote:
> On 5/11/05, Autrijus Tang <[EMAIL PROTECTED]> wrote:
> > In a somewhat related topic:
> >
> > pugs> (1,(2,3),4)[2]
> > 4
> >
> > Because the invocant to .[] assumes a Singular
On Wed, May 11, 2005 at 03:00:15PM -0600, Luke Palmer wrote:
> On 5/11/05, Autrijus Tang <[EMAIL PROTECTED]> wrote:
> > In a somewhat related topic:
> >
> > pugs> (1,(2,3),4)[2]
> > 4
> >
> > Because the invocant to .[] assumes a Singu
On 5/11/05, Autrijus Tang <[EMAIL PROTECTED]> wrote:
> In a somewhat related topic:
>
> pugs> (1,(2,3),4)[2]
> 4
>
> Because the invocant to .[] assumes a Singular context.
Right, but the *inside* of the invocant is still a list, so it's in
list context.
In a somewhat related topic:
pugs> (1,(2,3),4)[2]
4
Because the invocant to .[] assumes a Singular context.
I'm not sure how any invocant can assume a Plural context anyway,
so this behaviour seems correct. Is it, though? :)
Thanks,
/Autrijus/
pgpihJttxQxy9.pgp
Descript
47 matches
Mail list logo