Re: push with lazy lists

2004-07-22 Thread Peter Behroozi
On Fri, 2004-07-16 at 12:10 -0400, Jonadab the Unsightly One wrote: Austin Hastings [EMAIL PROTECTED] writes: Half of all numbers in [0, Inf) are in the range [Inf/2, Inf). Which collapses to the range [Inf, Inf). It's not that simple. By that reasoning, 10% of all numbers in [0,Inf)

Re: push with lazy lists

2004-07-20 Thread Michele Dondi
On Mon, 19 Jul 2004, Jonadab the Unsightly One wrote: If I extend the natural numbers N with Inf to a new set NI (N with Inf) The problem is, NI is not a group with respect to addition for any definition of addition of which I am aware. Translated from mathese In other words, or more

Re: push with lazy lists

2004-07-19 Thread Jonadab the Unsightly One
Ph. Marek [EMAIL PROTECTED] writes: This is obviously some new definition of Inf of which I was not previously aware. Well, after reading my sentence one more, I see what may have caused some troubles. Inf is not in N; but *in my understanding* it fits naturally as an extension to N, that

Re: push with lazy lists

2004-07-19 Thread Larry Wall
On Mon, Jul 19, 2004 at 09:55:14PM -0400, Jonadab the Unsightly One wrote: : It is possible to construct a group that includes infinities, but NI : isn't it, and for Perl purposes it doesn't seem necessary. Though if someone wants to hack surreals into 6.1, that'd be cool. :-) Larry

Re: push with lazy lists

2004-07-18 Thread Ph. Marek
On Friday 16 July 2004 18:23, Jonadab the Unsightly One wrote: Please take my words as my understanding, ie. with no connection to mathmatics or number theory or whatever. I'll just say what I believe is practical. [...] I'd believe that infinity can be integer, ie. has no numbers after

Re: push with lazy lists

2004-07-16 Thread Jonadab the Unsightly One
Austin Hastings [EMAIL PROTECTED] writes: Half of all numbers in [0, Inf) are in the range [Inf/2, Inf). Which collapses to the range [Inf, Inf). It's not that simple. By that reasoning, 10% of all numbers in [0,Inf) would be in [Inf/10,Inf), also reducing to the range [Inf,Inf). For that

Re: push with lazy lists

2004-07-16 Thread Jonadab the Unsightly One
David Storrs [EMAIL PROTECTED] writes: Does it even make sense to take the Infiniteth element of an array? No. At best, it would be undefined, so we could define it to return undef. I think I would prefer if using Inf as an array index resulted in a trappable error. Or that, yeah. --

Re: push with lazy lists

2004-07-16 Thread Jonadab the Unsightly One
Ph. Marek [EMAIL PROTECTED] writes: Please take my words as my understanding, ie. with no connection to mathmatics or number theory or whatever. I'll just say what I believe is practical. [...] I'd believe that infinity can be integer, ie. has no numbers after the comma; and infinity is in

Re: push with lazy lists

2004-07-16 Thread Simon Cozens
[EMAIL PROTECTED] (David Storrs) writes: Does it even make sense to take the Infiniteth element of an array? You should have used a hash in the first place. -- BASH is great, it dumps core and has clear documentation. -Ari Suntioinen

Re: push with lazy lists

2004-07-15 Thread Michele Dondi
On Wed, 14 Jul 2004, Ph. Marek wrote: Please take my words as my understanding, ie. with no connection to mathmatics or number theory or whatever. I'll just say what I believe is practical. OT As a side note, being what one would probably call a mathematically oriented person, it is very

Re: push with lazy lists

2004-07-15 Thread Andrew Rodland
On Wednesday 14 July 2004 12:58 pm, Brent 'Dax' Royal-Gordon wrote: Andrew Rodland wrote: So if we have @x = [1, 3, 5, 6 .. 9, 10 .. Inf, 42]; ... 42 is just one number, so questions of indexing it are moot, but its distance from the left is Inf. So, there's no way to access the 42 by

Re: push with lazy lists

2004-07-14 Thread David Storrs
On Wed, Jul 14, 2004 at 07:40:33AM +0200, Ph. Marek wrote: To repeat Dave and myself - if @x = 1 .. Inf; then rand(@x) should be Inf, and so print $x[rand(@x)]; should give Inf, as the infinite element of @x is Inf. Does it even make sense to take the Infiniteth element

Re: push with lazy lists

2004-07-14 Thread Ph. Marek
On Wednesday 14 July 2004 08:39, David Storrs wrote: To repeat Dave and myself - if @x = 1 .. Inf; then rand(@x) should be Inf, and so print $x[rand(@x)]; should give Inf, as the infinite element of @x is Inf. Please take my words as my understanding, ie. with no

Re: push with lazy lists

2004-07-14 Thread Andrew Rodland
On Wednesday 14 July 2004 04:55 am, Ph. Marek wrote: On Wednesday 14 July 2004 08:39, David Storrs wrote: To repeat Dave and myself - if @x = 1 .. Inf; then rand(@x) should be Inf, and so print $x[rand(@x)]; should give Inf, as the infinite element of @x is Inf.

Re: push with lazy lists

2004-07-13 Thread David Green
On 7/12/04, Austin Hastings wrote: --- Larry Wall [EMAIL PROTECTED] wrote: The hard part being to pick a random number in [0,Inf) uniformly. :-) Half of all numbers in [0, Inf) are in the range [Inf/2, Inf). Which collapses to the range [Inf, Inf). Returning Inf seems to satisfy the uniform

Re: push with lazy lists

2004-07-13 Thread Luke Palmer
David Green writes: On 7/12/04, Austin Hastings wrote: --- Larry Wall [EMAIL PROTECTED] wrote: The hard part being to pick a random number in [0,Inf) uniformly. :-) Half of all numbers in [0, Inf) are in the range [Inf/2, Inf). Which collapses to the range [Inf, Inf). Returning Inf seems

Re: push with lazy lists

2004-07-13 Thread Ph. Marek
--- Larry Wall [EMAIL PROTECTED] wrote: The hard part being to pick a random number in [0,Inf) uniformly. :-) Half of all numbers in [0, Inf) are in the range [Inf/2, Inf). Which collapses to the range [Inf, Inf). Returning Inf seems to satisfy the uniform distribution requirement: if you

Re: push with lazy lists

2004-07-12 Thread Ph. Marek
On Thursday 08 July 2004 05:25, Larry Wall wrote: : say @x[rand]; # how about now? Well, that's always going to ask for @x[0], which isn't a problem. However, if you say rand(@x), it has to calculate the number of elements in @x, which could take a little while... I'd expect to be rand(@x) =

Re: push with lazy lists

2004-07-12 Thread Brent 'Dax' Royal-Gordon
Ph. Marek wrote: On Thursday 08 July 2004 05:25, Larry Wall wrote: : say @x[rand]; # how about now? Well, that's always going to ask for @x[0], which isn't a problem. However, if you say rand(@x), it has to calculate the number of elements in @x, which could take a little while... I'd expect to

Re: push with lazy lists

2004-07-12 Thread Dave Whipp
Ph. Marek [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thursday 08 July 2004 05:25, Larry Wall wrote: : say @x[rand]; # how about now? Well, that's always going to ask for @x[0], which isn't a problem. However, if you say rand(@x), it has to calculate the number of

Re: push with lazy lists

2004-07-12 Thread Austin Hastings
--- Dave Whipp [EMAIL PROTECTED] wrote: rand(@x) == @x.rand == @x[ rand int @x ] == @x[ rand(1) * @x ] guaranteeing a uniform distribution unless adverbial modifiers are used. Meaning I can do: $avg_joe = rand @students :bell_curve; ? =Austin

Re: push with lazy lists

2004-07-12 Thread Larry Wall
On Mon, Jul 12, 2004 at 10:12:03AM -0700, Austin Hastings wrote: : --- Dave Whipp [EMAIL PROTECTED] wrote: : :rand(@x) == @x.rand == @x[ rand int @x ] == @x[ rand(1) * @x ] : : guaranteeing a uniform distribution unless adverbial modifiers are : used. The hard part being to pick a random

Re: push with lazy lists

2004-07-12 Thread Austin Hastings
--- Larry Wall [EMAIL PROTECTED] wrote: On Mon, Jul 12, 2004 at 10:12:03AM -0700, Austin Hastings wrote: : --- Dave Whipp [EMAIL PROTECTED] wrote: : :rand(@x) == @x.rand == @x[ rand int @x ] == @x[ rand(1) * @x ] : : guaranteeing a uniform distribution unless adverbial modifiers are

Re: push with lazy lists

2004-07-12 Thread Larry Wall
On Mon, Jul 12, 2004 at 11:11:58AM -0700, Austin Hastings wrote: : --- Larry Wall [EMAIL PROTECTED] wrote: : The hard part being to pick a random number in [0,Inf) uniformly. :-) : : Half of all numbers in [0, Inf) are in the range [Inf/2, Inf). Which : collapses to the range [Inf, Inf).

Re: push with lazy lists

2004-07-08 Thread JOSEPH RYAN
On Wed, Jul 07, 2004 at 11:50:16PM -0400, JOSEPH RYAN wrote: To answer the latter first, rand (with no arguments) returns a number greater than or equal to 0 and less than 1 which when used as an index into an array gets turned into a 0. As to why the second pop would take forever, I'd

Re: push with lazy lists

2004-07-07 Thread Larry Wall
On Fri, Jul 02, 2004 at 09:32:07PM -0500, Dan Hursh wrote: : how 'bout : : @x = gather{ : loop{ : take time : } : } # can this be @x = gather { take time loop } : push @x, later; : say pop @x;# later Can probably be made to work right. : say pop @x;# heat death? Yes.

Re: push with lazy lists

2004-07-07 Thread JOSEPH RYAN
- Original Message - From: Larry Wall [EMAIL PROTECTED] Date: Wednesday, July 7, 2004 11:25 pm Subject: Re: push with lazy lists On Fri, Jul 02, 2004 at 09:32:07PM -0500, Dan Hursh wrote: : how 'bout : : @x = gather{ : loop{ : take time : } : } # can

Re: push with lazy lists

2004-07-07 Thread Jonathan Scott Duff
On Wed, Jul 07, 2004 at 11:50:16PM -0400, JOSEPH RYAN wrote: - Original Message - From: Larry Wall [EMAIL PROTECTED] Date: Wednesday, July 7, 2004 11:25 pm Subject: Re: push with lazy lists On Fri, Jul 02, 2004 at 09:32:07PM -0500, Dan Hursh wrote: : how 'bout : : @x

Re: push with lazy lists

2004-07-03 Thread Dan Hursh
Joseph Ryan wrote: The way I understand the magicness of lazy lists, I'd expect: @x = 3..Inf; say pop @x; # prints Inf @x = 3..Inf; push @x, 6; # an array with the first part being # lazy, and then the element 6 say pop @x; # prints 6 say pop @x; # prints Inf say pop @x; # prints Inf

Re: push with lazy lists

2004-07-03 Thread JOSEPH RYAN
- Original Message - From: Dan Hursh [EMAIL PROTECTED] Date: Friday, July 2, 2004 10:32 pm Subject: Re: push with lazy lists Joseph Ryan wrote: I guess that's true with X..Y lazy lists. I thought there were other ways to make lazy lists, like giving it a closure that gets called

push with lazy lists

2004-07-02 Thread Dan Hursh
Hi, If I can assume: @x = 3..5; say pop @x;# prints 5 @x = 3..5; push @x, 6; say pop @x;# prints 6 say pop @x;# prints 5 What should I expect for the following? @x = 3..Inf; say pop @x;# heat death?

Re: push with lazy lists

2004-07-02 Thread JOSEPH RYAN
- Original Message - From: Dan Hursh [EMAIL PROTECTED] Date: Friday, July 2, 2004 2:23 pm Subject: push with lazy lists Hi, If I can assume: @x = 3..5; say pop @x;# prints 5 @x = 3..5; push @x, 6; say pop @x;# prints 6 say