Re: the handiness of undef becoming NaN (when you want that)

2001-10-22 Thread Glenn Linderman
Aaron Sherman wrote: Let's take this code as an example: while() { $count++; $total += substr($_,22,2); } printf Average: %.2f\n, $total/$count; Right now, if my expected numeric column has garbage in it on the 400,000th line, I

Re: the handiness of undef becoming NaN (when you want that)

2001-10-22 Thread Sam Vilain
On Mon, 22 Oct 2001 12:18:16 -0400 Aaron Sherman [EMAIL PROTECTED] wrote: $z[0] = 50; $z[2] = 20; @x = @y[@z]; In your code, should @x contain (@y[50,0,20]) or (@y[50,20]) or (@y[50,undef,20]) ? @y[50,undef,20], which in Perl5 is @y[50,0,20]. An arbitrary and perhaps

Re: the handiness of undef becoming NaN (when you want that)

2001-10-22 Thread Glenn Linderman
Aaron Sherman wrote: I see your point, but going from: you have to error-check to be sure that the average you get is valid to you get NaN and like it is a bit steep. you get NaN and like it only happens when you put garbage in... and get garbage out. Yes, NaN is garbage. But when it

RE: the handiness of undef becoming NaN (when you want that)

2001-10-22 Thread David Whipp
More, someone has mentioned the %x{$_}++ feature, which IMHO, MUST continue to work. What is void plus one? Can't we utilize the lazy arrays stuff to make all this work. Out of the box, all entries could default to NaN. But its easy to write @a ^= 0; to change this default. I'm

Re: the handiness of undef becoming NaN (when you want that)

2001-10-22 Thread Piers Cawley
Aaron Sherman [EMAIL PROTECTED] writes: On Mon, Oct 22, 2001 at 04:27:24PM +0100, Sam Vilain wrote: On Fri, 19 Oct 2001 09:27:50 -0400 Aaron Sherman [EMAIL PROTECTED] wrote: I am implementing a textbook algo in Perl (the textbook has it written in C++) and have realized that if undef

Default values, was RE: the handiness of undef becoming NaN (when you want that)

2001-10-22 Thread David Whipp
Aaron Sherman wrote On Mon, Oct 22, 2001 at 11:30:01AM -0700, David Whipp wrote: More, someone has mentioned the %x{$_}++ feature, which IMHO, MUST continue to work. What is void plus one? Can't we utilize the lazy arrays stuff to make all this work. Out of the box, all

RE: Default values, was RE: the handiness of undef becoming NaN (when you want that)

2001-10-22 Thread David Whipp
Aaron Sherman wrote Larry's hubris notwithstanding, I'd like to suggest that more, in this case means no, it prints nothing. This *must* be true, as you don't want: @a ^+ @b to always return an infinite list. You want it to produce a list with (as a3 suggested) length

Re: De NaN-ibus

2001-10-22 Thread Damian Conway
Hufgo suggested: :Have I missed anything? Code, and docs, for ieee.pm. Other than that, it looks good to me. :) Ah, but that's a SMoP, left as an exercise to the reader. ;-) Damian