Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-10 Thread Jeremy Howard
John Porter wrote: > Jeremy Howard wrote: > > The reason that having (1..) implies having (..-1) is that if you allow > > (1..), then this is a valid construct: > > > > @dot_dot_neg_one = reverse (map {-$_} (1..)); > > > > which is identical to (..-1)! > > No, NOT identical. The same set of num

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-10 Thread John Porter
Jeremy Howard wrote: > The reason that having (1..) implies having (..-1) is that if you allow > (1..), then this is a valid construct: > > @dot_dot_neg_one = reverse (map {-$_} (1..)); > > which is identical to (..-1)! No, NOT identical. The same set of numbers, yes, but generated in the o

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-09 Thread Damian Conway
> > I'm thinking of recanting the whole RFC! :-) > > <*checking etymology*> hmmm . . . "recant" . . . "recant" . . . > doesn't that mean to sing the whole thing over again? Literally: "to sing a different tune". :-) > Seems to me that while putting hooks in the core to allow thi

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-09 Thread Ted Ashton
Thus it was written in the epistle of Damian Conway, >> I'm looking forward to the upcoming writeup :-). > > I'm thinking of recanting the whole RFC! :-) <*checking etymology*> hmmm . . . "recant" . . . "recant" . . . doesn't that mean to sing the whole thing over again? :-), Ted P.S. Se

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-09 Thread Damian Conway
> I'm looking forward to the upcoming writeup :-). I'm thinking of recanting the whole RFC! :-) Damian

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-09 Thread Ted Ashton
Thus it was written in the epistle of Jeremy Howard, > The reason that having (1..) implies having (..-1) is that if you allow > (1..), then this is a valid construct: > > @dot_dot_neg_one = reverse (map {-$_} (1..)); > > which is identical to (..-1)! So scrapping (..-1) doesn't actually win y

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-09 Thread Jeremy Howard
Ted Ashton wrote: > I understand very well the concern. I, for one, don't agree that having > (1..) in the language implies that having (..-1) is possible (though it does > make sense to me that having (1..) and (..-1) would imply having (..)). After > all, if I were to write > > for (1..) { >

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-09 Thread Jeremy Howard
Ted Ashton wrote: > Thus it was written in the epistle of John Porter, > > Ken Fox wrote: > > > > > > Both of those expressions are the infinite list (-infinity..-1). I have > > > no idea how to write that properly 'cause I'm not a math guy. These > > > things aren't streams (infinite queues) -- t

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-09 Thread James Mastros
Tangentialy, can I suggest that a nicer synthax might be -Inf..-1 / 1..Inf, etc. Assuming that we end up supporting full IEEE floats, this becomes the "obvious" synthax, and I find C<(-Inf..Inf)> to be far more clear then C<(..)>. We've got plenty of puncuation already, thank you very much. Als

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-09 Thread Ted Ashton
John Porter replied to what > Ted Ashton wrote: > > John Porter: > > > > > > What would be the output of the following program: > > > > > > $\ = "\n"; > > > $i = 0; > > > for ( .. -1 ) { > > > $i++; > > > last if $i > 2; > > > print > > > } > > > > > > If

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-09 Thread John Porter
Ted Ashton wrote: > John Porter: > > > > What would be the output of the following program: > > > > $\ = "\n"; > > $i = 0; > > for ( .. -1 ) { > > $i++; > > last if $i > 2; > > print > > } > > > > If the answer is (as I suspect), "This never

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-09 Thread Ted Ashton
Thus it was written in the epistle of John Porter, > Ken Fox wrote: > > > > Both of those expressions are the infinite list (-infinity..-1). I have > > no idea how to write that properly 'cause I'm not a math guy. These > > things aren't streams (infinite queues) -- they're infinite stacks. I'm >

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-09 Thread John Porter
Ken Fox wrote: > > Both of those expressions are the infinite list (-infinity..-1). I have > no idea how to write that properly 'cause I'm not a math guy. These > things aren't streams (infinite queues) -- they're infinite stacks. I'm > not sure they have a name in computer science. O.k., here's

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-08 Thread Jeremy Howard
Ken Fox wrote: > John Porter wrote: > > Jeremy Howard wrote: > > > Yes, they're not identical. What I mean of course is: > > > (..-1) == reverse(map -__ (1..)); > > > > WHAT? So the semantics of .. are magically different in the context > > of (..$n) so as to produce numbers in descending order

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-08 Thread Ken Fox
John Porter wrote: > Jeremy Howard wrote: > > Yes, they're not identical. What I mean of course is: > > (..-1) == reverse(map -__ (1..)); > > WHAT? So the semantics of .. are magically different in the context > of (..$n) so as to produce numbers in descending order? Both of those expressions

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-07 Thread John Porter
Jeremy Howard wrote: > Yes, they're not identical. What I mean of course is: > (..-1) == reverse(map -__ (1..)); WHAT? So the semantics of .. are magically different in the context of (..$n) so as to produce numbers in descending order? I don't think so. -- John Porter

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-07 Thread Leon Brocard
Damian Conway sent the following bits through the ether: > Rather than continue to argue the details, why don't people post some > examples of code where they feel these lazy lists might be useful, and > let's see if there aren't already good alternatives. It should be noted that "infinite" lazi

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-06 Thread Jeremy Howard
> > Another win is in evaluation of lists constructed by generator functions: > > # ($start: f(__): $end) == ($start, f($start), f(f($start)), ...) > > @powersOf2 = (1:__*2:); # (1, 2, 4, 8, ...) > > @first10PowersOf2 = @powersOf2[0..9]; # Calculates 1st 10 powers of 2 > > # ...interesting

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-06 Thread Ariel Scolnicov
"Jeremy Howard" <[EMAIL PROTECTED]> writes: > Damian Conway wrote: [...] > > Personally, I intend only to update the RFC to include the *possibility* > > of (..$x) and (..). I'm reasonably sure Larry will kill the whole thing > > -- I think I might too, were I in his place ;-) > > > Now don't

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-06 Thread Jeremy Howard
Damian Conway wrote: > I think I opened a bigger can of worms than I intended :-) Yes, sorry about the overload of email you must of got from me on this, this morning ;-) > > As MJD as pointed out to me in private email, if we are serious > about this feature, we probably want to go the whole hog

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-06 Thread Jeremy Howard
> (Note that I'm keeping the ':' notation, because then it's clear that we're > talking about a generation rule, not an upper bound). Now I write it like > this, wouldn't it be nice if we could also say: > (1..:f(__)) == apply(f(__), (1..); # But I digress! > Correction (sorry). This should be:

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-06 Thread Damian Conway
I think I opened a bigger can of worms than I intended :-) As MJD as pointed out to me in private email, if we are serious about this feature, we probably want to go the whole hog and look at Haskell's notion of list comprehensions. See http://www.haskell.org/tutorial/goodies.html speci

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-06 Thread Jeremy Howard
Ken Fox wrote: > Jeremy Howard wrote: > > (..-1) == map -__ (1..); > > That really confuses me. If the sequence (-4..-1) is (-4, -3, > -2, -1) then I don't see how your semantics are consistent. I'll > admit (reverse map -__ (1..)) is the same as (..-1) but reverse > on a stream is undefined. (I

Re: Infinite lists (was Re: RFC 24 (v1) Semi-finite (lazy) lists)

2000-08-06 Thread Ken Fox
Jeremy Howard wrote: > (..-1) == map -__ (1..); That really confuses me. If the sequence (-4..-1) is (-4, -3, -2, -1) then I don't see how your semantics are consistent. I'll admit (reverse map -__ (1..)) is the same as (..-1) but reverse on a stream is undefined. (It should be a run-time error