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
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
> > 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
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
> I'm looking forward to the upcoming writeup :-).
I'm thinking of recanting the whole RFC! :-)
Damian
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
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..) {
>
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
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
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
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
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
>
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
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
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
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
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
> > 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
"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
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
> (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:
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
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
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
24 matches
Mail list logo