Re: Hyperoperators and RFC 207

2001-10-11 Thread Jeremy Howard
[EMAIL PROTECTED] wrote: > > > @arr3 = @arr1[^i] + @arr2[^i] # also @arr[^i] = @arr1[^i] + @arr2[^i] > > > > Hyper-operators do this just fine. > > > Oh yes they do. The point is that the ^i-loop way is better (more powerful and simpler at the same time). > > Maybe the examples where not good en

Re: NaN+NaNi

2001-10-11 Thread RaFaL Pocztarski
Jonathan Scott Duff wrote: > It's bothered me that I can write 100_000 in my perl code, but if I have > a string "100_000" it'll evaluate to 100 when numerified. It would be > really weird if "10indigo" became 10i, "1e3foobar" became 1000, and > "10_000" became 10 in Perl 6 IMHO. That should be

Re: NaN+NaNi

2001-10-11 Thread RaFaL Pocztarski
Glenn Linderman wrote: > On the other hand, there is a case to be made that any form of number that > might get printed by perl's unformatted i.e. > > print 0+$var > > should be reconvertible back to a string via implicit numeric conversions of > strings. I think the only thing that would af

Re: NaN+NaNi

2001-10-11 Thread RaFaL Pocztarski
Aaron Sherman wrote: > For example, zero-filled numbers are not converted to octal because > many text files contain zero-filled numbers. > > The idea that "0cat" is "0", but "0xat" is 10 will confuse a lot of folk. It all should be at least possible to do, but not mandatory. > If strings in nu

Re: NaN+NaNi

2001-10-11 Thread RaFaL Pocztarski
raptor wrote: > | It's bothered me that I can write 100_000 in my perl code, but if I have > | a string "100_000" it'll evaluate to 100 when numerified. It would be > | really weird if "10indigo" became 10i, "1e3foobar" became 1000, and > | "10_000" became 10 in Perl 6 IMHO. > > ]- Agree if u wan

Re: Hyperoperators and RFC 207

2001-10-11 Thread afaus
> > > @arr3 = @arr1[^i] + @arr2[^i] # also @arr[^i] = @arr1[^i] + @arr2[^i] > > Hyper-operators do this just fine. > Oh yes they do. The point is that the ^i-loop way is better (more powerful and simpler at the same time). Maybe the examples where not good enough. Take the @b ^/ $a expressi

Re: NaN+NaNi

2001-10-11 Thread RaFaL Pocztarski
(sorry, I posted it before I finished...) Dan Sugalski wrote: > Sure. 5 + 10i will probably evaluate to "5" + "10i" and just get > constant-folded at compile time. ;) That's good to know. :) > >I don't think that imaginary numbers should have > >their own class, like real ones have. > > If we

Re: NaN+NaNi

2001-10-11 Thread RaFaL Pocztarski
Dan Sugalski wrote: > At 01:27 PM 10/11/2001 +0200, RaFaL Pocztarski wrote: > >David Nicol wrote: > > > > > RaFaL Pocztarski wrote: > > > > > > > > First this thread tells me that "123foo" will be 123 in numeric > > > > > context. Now I find myself wondering what "123indigo" evaluates > > > > > t

Re: Hyperoperators and RFC 207

2001-10-11 Thread Aaron Sherman
On Thu, Oct 11, 2001 at 08:06:15PM +0200, Angel Faus wrote: > > Maybe i should better explain myself with an example. > > @arr3 = @arr1[^i] + @arr2[^i] # also @arr[^i] = @arr1[^i] + @arr2[^i] Hyper-operators do this just fine. > @arr4 = $v * @arr1[^i] > $sum =+ @arr1[^i] > @lengths_array =

Re: reduce via ^

2001-10-11 Thread Larry Wall
[EMAIL PROTECTED] writes: : Given: : :> $a = 1; :> @b = (1, 2, 3); : : Damian suggested that: : :> $a = $a ^+ @b :> :> becomes: :> :> $a = ($a, $a, $a) ^+ (1, 2, 3) :> $a = (1, 1, 1) ^+ (1, 2, 3) :> $a = (2, 3, 4) :> $a = 4; : : Whereas Piers thought

pizza, a superset of java

2001-10-11 Thread David Nicol
http://www.cl.cam.ac.uk/~cu200/Prover/index.html

NaN+NaNi

2001-10-11 Thread David Nicol
RaFaL Pocztarski wrote: > > First this thread tells me that "123foo" will be 123 in numeric > > context. Now I find myself wondering what "123indigo" evaluates > > to! Also 123. I think that complex numbers, if happening automatically, would only match ($realpart, $imaginarypart) = /^\b(\d

Re: NaN semantics

2001-10-11 Thread David Nicol
RaFaL Pocztarski wrote: > I haven't got any contact with NaN before, but when Tim pointed that > NaN!=NaN is true in IEEE I thought that it does make sense. I see pros > and cons and it's not so ugly and non-intuitive as it can look. When > comparing $a and $b as numbers there is no need for $a==

Re: NaN+NaNi

2001-10-11 Thread Glenn Linderman
Aaron Sherman wrote: > > It's bothered me that I can write 100_000 in my perl code, but if I have > > a string "100_000" it'll evaluate to 100 when numerified. It would be > > really weird if "10indigo" became 10i, "1e3foobar" became 1000, and > > "10_000" became 10 in Perl 6 IMHO. Note that in

Hyperoperators and RFC 207

2001-10-11 Thread Angel Faus
Hi to all, I have been thinking lately about hyperoperators, and particulary about its similarity with RFC 207 (Arrays: Efficient Array Loops) For the ones that don't have the RFC in mind, I copy its abstract: >This RFC proposes a notation for creating efficient implicit >loops over mul

Re: NaN+NaNi

2001-10-11 Thread Jonathan Scott Duff
On Thu, Oct 11, 2001 at 01:26:12PM -0400, Aaron Sherman wrote: > No, I think if you want "10_000" to be 1, you can always > eval it, but I don't think anyone reading in text should expect > that. I'll agree as long as we make the string "1e2foo" evaluate to 1 in a numeric context rather than

RE: General Feelings on Apoc 3

2001-10-11 Thread David Wheeler
On Tue, 2001-10-09 at 22:42, Damian Conway wrote: > Brent asked: > >> If we have 'and', 'or' and 'xor', can we have 'dor' (defined or) to be a >> low-precedence version of this? > > I actually suggested exactly that to Larry a few weeks back. > > He likes the idea, but is having trouble

Re: NaN+NaNi

2001-10-11 Thread Aaron Sherman
On Thu, Oct 11, 2001 at 10:28:34AM -0500, Jonathan Scott Duff wrote: > On Thu, Oct 11, 2001 at 11:13:59AM -0400, Dan Sugalski wrote: > > As for more complex string literals evaluating to numbers, I think that's > > something best left to either a user-written sub, or user-written fancy > > parse

Re: NaN+NaNi

2001-10-11 Thread raptor
| > As for more complex string literals evaluating to numbers, I think that's | > something best left to either a user-written sub, or user-written fancy | > parser hacks. Up to Larry whether it goes in the base language, but I think | > I'd prefer not. | | Speaking of string turning into numbers

Re: NaN+NaNi

2001-10-11 Thread Jonathan Scott Duff
On Thu, Oct 11, 2001 at 11:13:59AM -0400, Dan Sugalski wrote: > As for more complex string literals evaluating to numbers, I think that's > something best left to either a user-written sub, or user-written fancy > parser hacks. Up to Larry whether it goes in the base language, but I think > I'd

Re: NaN+NaNi

2001-10-11 Thread Dan Sugalski
At 01:27 PM 10/11/2001 +0200, RaFaL Pocztarski wrote: >David Nicol wrote: > > > RaFaL Pocztarski wrote: > > > > > > First this thread tells me that "123foo" will be 123 in numeric > > > > context. Now I find myself wondering what "123indigo" evaluates > > > > to! > > > > Also 123. I think that co

Re: Apoc 2 - Loss of $#foo - Use of hash functions on arrays

2001-10-11 Thread Nguon Hao Ching
> # proposed > foreach $index (keys @array) { > do_something($index, @array[$index]); > } That's too much like PHP, and people would start thinking arrays and hashes are the same type (associative arrays with autoquoted keys). I think it's a good idea anyway. -Hao

Apoc 2 - Loss of $#foo - Use of hash functions on arrays

2001-10-11 Thread Mike Depot
The section of Apocalypse 2 'Other Decisions About Variables' states: "$#foo is gone. If you want the final subscript of an array, and [-1] isn't good enough, use @foo.end instead." Here is an example where -1 is not good enough: # this perl 5 code... foreach $index (0..$#array) { do_somethi

Re: NaN semantics

2001-10-11 Thread RaFaL Pocztarski
David Nicol wrote: > RaFaL Pocztarski wrote: > > Or maybe NaN evaluates to 'NaN' in string context and > > +$x eq 'NaN' (or +$x eq NaN) could be used? NaN==NaN being false is in > > fact very intuitive for me, as NaN is something without any numerical > > meaning, so numerically compared to anyt

Re: NaN+NaNi

2001-10-11 Thread RaFaL Pocztarski
David Nicol wrote: > RaFaL Pocztarski wrote: > > > > First this thread tells me that "123foo" will be 123 in numeric > > > context. Now I find myself wondering what "123indigo" evaluates > > > to! > > Also 123. I think that complex numbers, if happening automatically, > would only match > >

Re: reduce via ^

2001-10-11 Thread Damian Conway
Given: > $a = 1; > @b = (1, 2, 3); Damian suggested that: > $a = $a ^+ @b > > becomes: > > $a = ($a, $a, $a) ^+ (1, 2, 3) > $a = (1, 1, 1) ^+ (1, 2, 3) > $a = (2, 3, 4) > $a = 4; Whereas Piers thought that: > $a = $a ^+ @b > > becomes: > > $

Re: reduce via ^

2001-10-11 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > Colin exemplifies: > >> $a = 1; >> @a = (1); >> @b = (1, 2, 3); >> @c = (4, 5, 6); >> >> $a = $a ^+ @b; >> @a = @a ^+ @b; >> >> print $a; # 7 > > No. It will (probably) print: 4. Because: > > $a = $a ^