Re: Iterator semantics

2008-09-12 Thread Ashley Winters
On Fri, Sep 12, 2008 at 11:33 AM, Daniel Ruoso <[EMAIL PROTECTED]> wrote: > In SMOP, I'm probably going to presume that everything needs to be lazy, > then even: > > my @o = grep { /\d+/ } =$*IN; > my @a = (1,2,(3,4,@o)); > my @b = (1,2,(3,4,@a)); Can only one array "have" the iterator? If not,

Re: Iterator semantics

2008-09-12 Thread Daniel Ruoso
Qui, 2008-09-11 às 12:13 -0700, Larry Wall escreveu: > And I guess the fundamental underlying constraint is that a list cannot > be considered immutable unless its feeds can be considered immutable, > at least in some kind of idempotent sense. This conflicts with the > whole point of reactive prog

Re: Iterator semantics

2008-09-12 Thread Eric Wilhelm
Hi Larry, # from Larry Wall # on Thursday 11 September 2008 12:13: >So when you put something into a list context, some of the values >will be considered "easy", and some will be considered "hard". >The basic question is whether we treat those the same or differently >from a referential point of

Re: Iterator semantics

2008-09-11 Thread Aristotle Pagaltzis
* Larry Wall <[EMAIL PROTECTED]> [2008-09-11 21:20]: > As a first shot at that definition, I'll submit: > > 1 .. $n # easy > 1 .. *# hard > > On the other hand, I can argue that if the first expression is > easy, then the first $n elements of 1..* should also be > considered easy, a

Re: Iterator semantics

2008-09-11 Thread Larry Wall
On Tue, Sep 09, 2008 at 08:50:02AM -0700, Larry Wall wrote: : At the moment the design of Perl 6 (unlike certain FP languages) is : that any dependence on the *degree* of laziness is erroneous, except : insofar as infinite lists must have *some* degree of laziness in order : not to use up all your

Re: Iterator semantics

2008-09-10 Thread John M. Dlugosz
Daniel Ruoso daniel-at-ruoso.com |Perl 6| wrote: The second example actually modifies the object stored in the variable '@a'. And that is a different issue. I disagree. The assignment operator, as opposed to the binding operator (:=) is an operator called on the Array object. It is the

Re: Iterator semantics

2008-09-09 Thread Daniel Ruoso
Ter, 2008-09-09 às 10:10 -0500, Patrick R. Michaud escreveu: > I think my question can be best understood by example -- what > does the following produce? > my @a = 1,2,3,4,5; > for @a { .say; @a = (); } The problem actually becomes more evident with my @a = 1,2,3,4,5; for @a { .say;

Re: Iterator semantics

2008-09-09 Thread John M. Dlugosz
TSa Thomas.Sandlass-at-vts-systems.de |Perl 6| wrote: Since Larry said that single assignment semantics is the ideal we should strive for, I would opt for the iterator being unaffected by the assignment to @a. When this happens the singly assigned former content of @a is snaphot by the iterator.

Re: Iterator semantics

2008-09-09 Thread John M. Dlugosz
e for loop. In other words, would the above produce "1\n2\n3\n4\n5\n" or "1\n" ? My followup question is then: my @a = 1,2,3,4,5; my @b = 6,7,8; for @a,@b { .say; @b = (); } I have more examples involving various aspects of list and iterator semantics, but the answers to the above will help guide my questions. Pm

Re: Iterator semantics

2008-09-09 Thread TSa
HaloO, Patrick R. Michaud wrote: My question is whether the change to @a inside the for loop affects the iterator created at the beginning of the for loop. Since Larry said that single assignment semantics is the ideal we should strive for, I would opt for the iterator being unaffected by the

Re: Iterator semantics

2008-09-09 Thread Larry Wall
es involving various aspects of list and : iterator semantics, but the answers to the above will help guide : my questions. At the moment the design of Perl 6 (unlike certain FP languages) is that any dependence on the *degree* of laziness is erroneous, except insofar as infinite lists must have *some* d

Iterator semantics

2008-09-09 Thread Patrick R. Michaud
above produce "1\n2\n3\n4\n5\n" or "1\n" ? My followup question is then: my @a = 1,2,3,4,5; my @b = 6,7,8; for @a,@b { .say; @b = (); } I have more examples involving various aspects of list and iterator semantics, but the answers to the above will help guide my questions. Pm