L-valueness of Arrays vs. Lists

2003-02-22 Thread Martin D Kealey
On Tue, 11 Feb 2003, Michael Lazzaro wrote: > What is the utility of the perl5 behavior: > > \($a,$b,$c) > > meaning > > (\$a, \$b, \$c) > > Do people really do that? ... Can someone give an example of an actual, > proper, use? Yes, I've used it like this: for (\($a,$b,$c)) {

Re: Arrays vs lists; A possible solution?

2003-02-13 Thread Erik Steven Harrison
-- On Thu, 13 Feb 2003 16:03:41 Joseph F. Ryan wrote: >Erik Steven Harrison wrote: > >> >>-- >> >>On Wed, 12 Feb 2003 17:14:17 >> Erik Steven Harrison wrote: >> >> >>>-- >>> >>>On Wed, 12 Feb 2003 18:29:29 >>>Joseph F. Ryan wrote: >>> >>> As near as I can tell, the only problem

Re: Arrays vs lists; A possible solution?

2003-02-13 Thread Joseph F. Ryan
Erik Steven Harrison wrote: -- On Wed, 12 Feb 2003 17:14:17 Erik Steven Harrison wrote: -- On Wed, 12 Feb 2003 18:29:29 Joseph F. Ryan wrote: As near as I can tell, the only problem with the nice flow of: A I is a piece of data. A I is a variable that holds a literal. A I is a se

Re: Arrays vs lists; A possible solution?

2003-02-13 Thread Joseph F. Ryan
Erik Steven Harrison wrote: -- On Wed, 12 Feb 2003 18:29:29 Joseph F. Ryan wrote: As near as I can tell, the only problem with the nice flow of: A I is a piece of data. A I is a variable that holds a literal. A I is a sequence of literals and scalars. An I is a variable that holds a list

Re: Arrays, lists, referencing (was Re: Arrays vs. Lists)

2003-02-12 Thread Deborah Ariel Pickett
> Here are some of the answers from my own notes. These behaviors have > all been confirmed on-list by the design team: > > An @array in list context returns a list of its elements > An @array in scalar context returns a reference to itself (NOTE1) > An @array in numeric (scalar) context retur

Re: Arrays vs lists; A possible solution?

2003-02-12 Thread Erik Steven Harrison
-- On Wed, 12 Feb 2003 17:14:17 Erik Steven Harrison wrote: > >-- > >On Wed, 12 Feb 2003 18:29:29 > Joseph F. Ryan wrote: >>As near as I can tell, the only problem with the nice flow of: >> >> A I is a piece of data. >> A I is a variable that holds a literal. >> >> A I is a sequence of lit

Re: Arrays vs lists; A possible solution?

2003-02-12 Thread Erik Steven Harrison
-- On Wed, 12 Feb 2003 18:29:29 Joseph F. Ryan wrote: >As near as I can tell, the only problem with the nice flow of: > > A I is a piece of data. > A I is a variable that holds a literal. > > A I is a sequence of literals and scalars. > An I is a variable that holds a list. > >is the "Rvalue-

Arrays vs lists; A possible solution?

2003-02-12 Thread Joseph F. Ryan
As near as I can tell, the only problem with the nice flow of: A I is a piece of data. A I is a variable that holds a literal. A I is a sequence of literals and scalars. An I is a variable that holds a list. is the "Rvalue-assign list", which takes the form of: ($r1, $r2, $r3) = (1, 2, 3); Wel

Re: Arrays vs. Lists

2003-02-12 Thread Erik Steven Harrison
-- On Tue, 11 Feb 2003 12:28:23 Luke Palmer wrote: >> Date: Tue, 11 Feb 2003 10:34:57 -0800 >> From: Michael Lazzaro <[EMAIL PROTECTED]> >> >> On Monday, February 10, 2003, at 05:56 PM, Luke Palmer wrote: >> > Indeed, this supports the distinction, which I will reiterate: >> > >> > - Ar

Re: Arrays, lists, referencing (was Re: Arrays vs. Lists)

2003-02-12 Thread Michael Lazzaro
On Tuesday, February 11, 2003, at 04:56 PM, Deborah Ariel Pickett wrote: But is it OK for a list to be silently promoted to an array when used as an array? So that all of the following would work, and not just 50% of them? (1..10).map {...} [1..10].map {...} And somehow related to al

Re: Arrays vs. Lists

2003-02-12 Thread Mark J. Reed
On 2003-02-12 at 11:07:45, Joseph F. Ryan wrote: > Meaning that "I think this should be possible, but I'm not > sure if that syntax is correct, because it would mean that > the arrayrefs would need to be their own class to allow > a method to be called on it. No, they wouldn't, unless I'm missing s

Re: Arrays vs. Lists

2003-02-12 Thread Joseph F. Ryan
Mark J. Reed wrote: On 2003-02-11 at 17:12:52, Joseph F. Ryan wrote: (@a,@b,@c).pop This doesn't make any sense, since pop modifies the pop-ee. What do you expect should happen here? [@a,@b,@c].pop Same as above. Except that the Perl5 equivalent, ugly as the syntax

Re: Arrays vs. Lists

2003-02-12 Thread Mark J. Reed
On 2003-02-11 at 16:52:36, Dave Whipp wrote: > "Mark J. Reed" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > On 2003-02-11 at 17:44:08, Mark J. Reed wrote: > > > pop @{[@a,@b,@c]} > > > > > > It creates an anonymous array, then removes the last

Arrays, lists, referencing (was Re: Arrays vs. Lists)

2003-02-11 Thread Deborah Ariel Pickett
> But is it OK for a list to be silently promoted to an array when used > as an array? So that all of the following would work, and not just 50% > of them? > (1..10).map {...} > [1..10].map {...} And somehow related to all this . . . Let's assume for the moment that there's still a fun

RE: Arrays vs. Lists

2003-02-11 Thread Brent Dax
Dave Whipp: # > Minor correction: we don't know how many elements are left in the # > array - it depends on how many elements were in @a, @b, and @c to # > start with. One less than that. :) # # These days you need the splat operator to flatten lists: so My understanding was that arrays would

Re: Arrays vs. Lists

2003-02-11 Thread Dave Whipp
"Michael Lazzaro" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > What is the utility of the perl5 behavior: > > \($a,$b,$c) > > meaning > > (\$a, \$b, \$c) > > Do people really do that? I must say, given that it looks *so > obviously* like it instead

Re: Arrays vs. Lists

2003-02-11 Thread Dave Whipp
"Mark J. Reed" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > On 2003-02-11 at 17:44:08, Mark J. Reed wrote: > > pop @{[@a,@b,@c]} > > > > It creates an anonymous array, then removes the last element, leaving two > > elements in the array - which is i

Re: Arrays vs. Lists

2003-02-11 Thread Uri Guttman
> "JFR" == Joseph F Ryan <[EMAIL PROTECTED]> writes: >> (@a,@b,@c).pop JFR> This doesn't make any sense, since pop modifies the pop-ee. JFR> What do you expect should happen here? >> [@a,@b,@c].pop JFR> Same as above. there is a subtle distinction in those two. the first should b

Re: Arrays vs. Lists

2003-02-11 Thread Mark J. Reed
On 2003-02-11 at 17:44:08, Mark J. Reed wrote: > pop @{[@a,@b,@c]} > > It creates an anonymous array, then removes the last element, leaving two > elements in the array - which is irrelevant since the array is > then discarded completely. Minor correction: we don't know how many element

Re: Arrays vs. Lists

2003-02-11 Thread Mark J. Reed
On 2003-02-11 at 17:12:52, Joseph F. Ryan wrote: > > (@a,@b,@c).pop > > This doesn't make any sense, since pop modifies the pop-ee. > What do you expect should happen here? > > > > > > [@a,@b,@c].pop > > > Same as above. Except that the Perl5 equivalent, ugly as the syntax may be, works

Re: Arrays vs. Lists

2003-02-11 Thread Joseph F. Ryan
Michael Lazzaro wrote: On Monday, February 10, 2003, at 05:56 PM, Luke Palmer wrote: Indeed, this supports the distinction, which I will reiterate: - Arrays are variables. - Lists are values. My hesitation about the 'arrays are variables' part is that Damian corrected me on a simi

Re: Arrays vs. Lists

2003-02-11 Thread Randal L. Schwartz
> "Michael" == Michael Lazzaro <[EMAIL PROTECTED]> writes: Michael> Do people really do that? I must say, given that it looks *so Michael> obviously* like it instead means [$a,$b,$c], I wonder if attempting to Michael> take a reference to a list should be a compile-time error. Michael> Note

Re: Arrays vs. Lists [x-adr]

2003-02-11 Thread Michael Lazzaro
On Tuesday, February 11, 2003, at 10:56 AM, Garrett Goebel wrote: What about this? \@array hmm. As perl Apoc2, Lists, RFC 175... arrays and hashes return a reference to themselves in scalar context... I'm not sure what context '\' puts them in. I'd guess \@array is a reference to an

Re: Arrays vs. Lists

2003-02-11 Thread Luke Palmer
> Date: Tue, 11 Feb 2003 10:34:57 -0800 > From: Michael Lazzaro <[EMAIL PROTECTED]> > > On Monday, February 10, 2003, at 05:56 PM, Luke Palmer wrote: > > Indeed, this supports the distinction, which I will reiterate: > > > > - Arrays are variables. > > - Lists are values. > > My hesitati

Re: Arrays vs. Lists [x-adr]

2003-02-11 Thread Mark J. Reed
[Recipients trimmed back to just p6-language; the Cc: list was getting a bit large.] On 2003-02-11 at 12:56:45, Garrett Goebel wrote: > I'd just stick with Uri's explanation. Arrays are allocated. Lists are > on the stack... Nuh-uh. Those are implementation details, not part of the language defin

RE: Arrays vs. Lists [x-adr]

2003-02-11 Thread Garrett Goebel
From: Michael Lazzaro [mailto:[EMAIL PROTECTED]] > > Just to clarify... in P6, is this an array reference, or a list > reference? > > [1,2,3] Exactly. It's still up in the air... Apoc 2, RFC 175: > So it works out that the explicit list composer: > >[1,2,3] > > is syntactic sugar f

Re: Arrays vs. Lists

2003-02-11 Thread Michael Lazzaro
On Monday, February 10, 2003, at 06:26 PM, Joseph F. Ryan wrote: Deborah Ariel Pickett wrote: (Just going off on a tangent: Is it true that an array slice such as @array[4..8] is syntactically equivalent to this list (@array[4], @array[5], @array[6], @array[7], @array[8]) ? Are array slices

Re: Arrays vs. Lists

2003-02-11 Thread Michael Lazzaro
On Monday, February 10, 2003, at 05:56 PM, Luke Palmer wrote: Indeed, this supports the distinction, which I will reiterate: - Arrays are variables. - Lists are values. My hesitation about the 'arrays are variables' part is that Damian corrected me on a similar thing when I was writin

Re: Arrays vs. Lists

2003-02-10 Thread Joseph F. Ryan
Deborah Ariel Pickett wrote: While I like the glib "Arrays are variables that hold lists" explanation that worked so well in Perl5, I think that Perl6 is introducing some changes to this that make this less true. Like what? Well, like the builtin switch statement, which was what I wa

Re: Arrays vs. Lists

2003-02-10 Thread Luke Palmer
> From: Deborah Ariel Pickett <[EMAIL PROTECTED]> > Date: Tue, 11 Feb 2003 11:15:13 +1100 (EST) > > In Perl6, where there seems to be even more of a blur between > compile-time and runtime, I don't think it's always going to be possible > (i.e., easy) to know where naming an array or providing an

Re: Arrays vs. Lists

2003-02-10 Thread Deborah Ariel Pickett
> >While I like the glib "Arrays are variables that hold lists" explanation > >that worked so well in Perl5, I think that Perl6 is introducing some > >changes to this that make this less true. > Like what? Well, like the builtin switch statement, which was what I was trying to show in my bad examp

RE: Arrays vs. Lists [x-adr]

2003-02-10 Thread Garrett Goebel
Uri Guttman wrote: > > arrays are allocated and lists are on the stack. so arrays > can have references to them but lists can't. Apoc 2, RFC 175: > > scalar(list(1,2,3)); [...] > scalar(array(1,2,3)); Which would imply one could take a reference to either. > can anyone see any changes in p

Re: Arrays vs. Lists

2003-02-09 Thread Joseph F. Ryan
Deborah Ariel Pickett wrote: I'm trying, and failing, to accurately and definitively answer the question "what's the difference between an array and a list in Perl6?" If someone can come up with a simple but accurate definition, it would be helpful. While I like the glib "Arrays are varia

Re: Arrays vs. Lists

2003-02-09 Thread Deborah Ariel Pickett
> I'm trying, and failing, to accurately and definitively answer the > question "what's the difference between an array and a list in Perl6?" > If someone can come up with a simple but accurate definition, it would > be helpful. While I like the glib "Arrays are variables that hold lists" explan

Re: Arrays vs. Lists

2003-02-07 Thread Uri Guttman
> "AT" == Adam Turoff <[EMAIL PROTECTED]> writes: AT> On Fri, Feb 07, 2003 at 06:38:36PM -0500, Uri Guttman wrote: >> > "ML" == Michael Lazzaro <[EMAIL PROTECTED]> writes: ML> Along those lines, the closest I've been able to come so far to a ML> usable two-sentence definition is:

Re: Arrays vs. Lists

2003-02-07 Thread Michael Lazzaro
On Friday, February 7, 2003, at 04:24 PM, Uri Guttman wrote: ML> \(1,2,3) ML> returns an array reference... in perl5 it returns a list of refs ( \1, \2, \3 ). i dunno the perl6 semantics. it could be the same as [ 1, 2, 3 ] which means it is not a Sorry, I was misremembering a threa

Re: Arrays vs. Lists

2003-02-07 Thread Luke Palmer
> Date: Fri, 7 Feb 2003 14:46:37 -0800 > From: Michael Lazzaro <[EMAIL PROTECTED]> > > > On Friday, February 7, 2003, at 02:07 PM, Uri Guttman wrote: > > the whole notion is that lists are always temporary and arrays can be > > as > > permanent as you want (an array ref going quickly out of sco

Re: Arrays vs. Lists

2003-02-07 Thread Adam Turoff
On Fri, Feb 07, 2003 at 06:38:36PM -0500, Uri Guttman wrote: > > "ML" == Michael Lazzaro <[EMAIL PROTECTED]> writes: > ML> Along those lines, the closest I've been able to come so far to a > ML> usable two-sentence definition is: > > ML> -- A list is an ordered set of scalar values. >

Re: Arrays vs. Lists

2003-02-07 Thread Uri Guttman
> "ML" == Michael Lazzaro <[EMAIL PROTECTED]> writes: ML> On Friday, February 7, 2003, at 03:38 PM, Uri Guttman wrote: >> but you can't derive the rules about allowing push/pop/splice/slice >> from >> that pair of defintions. ML> Is there any syntactic reason why both of the follow

Re: Arrays vs. Lists

2003-02-07 Thread Stéphane Payrard
On Fri, Feb 07, 2003 at 02:30:47PM -0500, Mark J. Reed wrote: > On 2003-02-07 at 14:26:42, Mark J. Reed wrote: > > Not really, though. A list can be an lvalue, provided it is a list > > of lvalues: Note that to avoid the burden of writing an explicit slice, 'undef' is considered as a lvalue in su

Re: Arrays vs. Lists

2003-02-07 Thread Michael Lazzaro
On Friday, February 7, 2003, at 03:38 PM, Uri Guttman wrote: but you can't derive the rules about allowing push/pop/splice/slice from that pair of defintions. Is there any syntactic reason why both of the following cannot be allowed? (1,2,3).pop [1,2,3].pop I don't know that one is

Re: Arrays vs. Lists

2003-02-07 Thread Dave Whipp
"Michael Lazzaro" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Along those lines, the closest I've been able to come so far to a > usable two-sentence definition is: > > -- A list is an ordered set of scalar values. quibble: that's an "ordered bag", isn't it?

Re: Arrays vs. Lists

2003-02-07 Thread Uri Guttman
> "ML" == Michael Lazzaro <[EMAIL PROTECTED]> writes: ML> On Friday, February 7, 2003, at 02:07 PM, Uri Guttman wrote: >> the whole notion is that lists are always temporary and arrays can >> be as >> permanent as you want (an array ref going quickly out of scope is very >> temporar

Re: Arrays vs. Lists

2003-02-07 Thread Michael Lazzaro
On Friday, February 7, 2003, at 02:07 PM, Uri Guttman wrote: the whole notion is that lists are always temporary and arrays can be as permanent as you want (an array ref going quickly out of scope is very temporary). lists can't live beyond the current expression but arrays can. Along those l

Re: Arrays vs. Lists

2003-02-07 Thread Uri Guttman
> "MJR" == Mark J Reed <[EMAIL PROTECTED]> writes: MJR> A reference is fundamentally a pointer, but that doesn't help. My point MJR> was that if you're talking about lists vs. arrays, you have at least MJR> three different syntaxes to distinguish: MJR> (1,2,3) MJR>

Re: Arrays vs. Lists

2003-02-07 Thread Mark J. Reed
On 2003-02-07 at 12:18:21, Austin Hastings wrote: > > Although this may reasonably be regarded as a special case; you > > certainly can't pop a list: > > > > (1,2,3).pop => error > > But could you do it the other way (function instead of method)? > pop (1,2,3) => ? Nope. At least, n

Re: Arrays vs. Lists

2003-02-07 Thread Austin Hastings
--- "Mark J. Reed" <[EMAIL PROTECTED]> wrote: > On 2003-02-07 at 11:13:07, Austin Hastings wrote: > > --- Michael Lazzaro <[EMAIL PROTECTED]> wrote: > > > I'm trying, and failing, to accurately and definitively answer > the > > > question "what's the difference between an array and a list in > >

Re: Arrays vs. Lists

2003-02-07 Thread Mark J. Reed
On 2003-02-07 at 14:26:42, Mark J. Reed wrote: > Not really, though. A list can be an lvalue, provided it is a list > of lvalues: > > ($a, $b, $c) = 1,2,3; Forgot the parens on the right side, there: ($a, $b, $c) = (1,2,3); > But they certainly aren't lvalues: > > [$a,$

Re: Arrays vs. Lists

2003-02-07 Thread Mark J. Reed
On 2003-02-07 at 11:13:07, Austin Hastings wrote: > --- Michael Lazzaro <[EMAIL PROTECTED]> wrote: > > I'm trying, and failing, to accurately and definitively answer the > > question "what's the difference between an array and a list in > > Perl6?" > > How's this? > > > A list is a

Re: Arrays vs. Lists

2003-02-07 Thread Austin Hastings
--- Michael Lazzaro <[EMAIL PROTECTED]> wrote: > > I'm trying, and failing, to accurately and definitively answer the > question "what's the difference between an array and a list in > Perl6?" > > If someone can come up with a simple but accurate definition, it > would be helpful. How's this? =

Arrays vs. Lists

2003-02-07 Thread Michael Lazzaro
I'm trying, and failing, to accurately and definitively answer the question "what's the difference between an array and a list in Perl6?" If someone can come up with a simple but accurate definition, it would be helpful. MikeL