Re: opPow, opDollar

2009-11-08 Thread Matti Niemenmaa
Stewart Gordon wrote: Andrei Alexandrescu wrote: Matti Niemenmaa wrote: Haskell has three exponentiation operators in the standard library: ^, ^^, and **. They are for non-negative integral exponents, integral exponents, and floating-point exponents respectively. I wonder whether that's an

Re: opPow, opDollar

2009-11-08 Thread Bill Baxter
On Sat, Nov 7, 2009 at 2:43 AM, Don nos...@nospam.com wrote: Walter Bright wrote: Don wrote: A little while ago I said I'd create a patch for ^^ as an exponentiation. A couple of people had requested that I make a post to the ng so they'd know when it happens. Here it is. This is opPow(),

Re: opPow, opDollar

2009-11-08 Thread Stewart Gordon
Matti Niemenmaa wrote: snip It's essentially because Haskell has separate type classes (knda like D interfaces... I won't go into that topic) for integers, fractional numbers, and floating-point numbers. In D the types of those three operators could be something like: anyinteger

Re: opPow, opDollar

2009-11-08 Thread Matti Niemenmaa
Stewart Gordon wrote: Matti Niemenmaa wrote: snip It's essentially because Haskell has separate type classes (knda like D interfaces... I won't go into that topic) for integers, fractional numbers, and floating-point numbers. In D the types of those three operators could be something

Re: opPow, opDollar

2009-11-08 Thread Philippe Sigaud
On Sat, Nov 7, 2009 at 17:33, Pelle Månsson pelle.mans...@gmail.com wrote: I am all in favor of adding convenience functions sum and product to phobos. I use them both often enough. vote++ And also min (on a range), max (on a range). Those are simple one-liners, though they can create some

Re: opPow, opDollar

2009-11-08 Thread Philippe Sigaud
On Sat, Nov 7, 2009 at 20:22, dsimcha dsim...@yahoo.com wrote: == Quote from Robert Jacques (sandf...@jhu.edu)'s article I'd recommend rolling that into a basic statistics struct containing common single pass metrics: i.e. sum, mean, variance, min, max, etc. I've been wondering for a while

Re: opPow, opDollar

2009-11-08 Thread Tim Matthews
Walter Bright wrote: Andrei Alexandrescu wrote: In order for everyone to air an informed opinion, a related question is: will loop fusion be allowed with function calls? Loop fusion currently only works with operators, and adding ^^ would allow: a[] = b[] ^^ 3; But with pow you can't do

opPow, opDollar

2009-11-07 Thread Don
A little while ago I said I'd create a patch for ^^ as an exponentiation. A couple of people had requested that I make a post to the ng so they'd know when it happens. Here it is. This is opPow(), x ^^ y http://d.puremagic.com/issues/show_bug.cgi?id=3481 And this is opDollar!(int dim) for

Re: opPow, opDollar

2009-11-07 Thread Walter Bright
Don wrote: A little while ago I said I'd create a patch for ^^ as an exponentiation. A couple of people had requested that I make a post to the ng so they'd know when it happens. Here it is. This is opPow(), x ^^ y http://d.puremagic.com/issues/show_bug.cgi?id=3481 I don't understand the

Re: opPow, opDollar

2009-11-07 Thread Lars T. Kyllingstad
Walter Bright wrote: Don wrote: A little while ago I said I'd create a patch for ^^ as an exponentiation. A couple of people had requested that I make a post to the ng so they'd know when it happens. Here it is. This is opPow(), x ^^ y http://d.puremagic.com/issues/show_bug.cgi?id=3481

Re: opPow, opDollar

2009-11-07 Thread Don
Walter Bright wrote: Don wrote: A little while ago I said I'd create a patch for ^^ as an exponentiation. A couple of people had requested that I make a post to the ng so they'd know when it happens. Here it is. This is opPow(), x ^^ y http://d.puremagic.com/issues/show_bug.cgi?id=3481 I

Re: opPow, opDollar

2009-11-07 Thread Mike James
the more mathematically-oriented languages use ^ And BASIC ;-) -=mike=-

Re: opPow, opDollar

2009-11-07 Thread Matti Niemenmaa
Don wrote: Yes, ^^ hasn't been used for exponentiation before. Fortran used ** because it had such a limited character set, but it's not really a natural choice; the more mathematically-oriented languages use ^. Obviously C-family languages don't have that possibility. Haskell has three

Re: opPow, opDollar

2009-11-07 Thread KennyTM~
On Nov 7, 09 18:43, Don wrote: Walter Bright wrote: Don wrote: A little while ago I said I'd create a patch for ^^ as an exponentiation. A couple of people had requested that I make a post to the ng so they'd know when it happens. Here it is. This is opPow(), x ^^ y

Re: opPow, opDollar

2009-11-07 Thread Andrei Alexandrescu
Matti Niemenmaa wrote: Don wrote: Yes, ^^ hasn't been used for exponentiation before. Fortran used ** because it had such a limited character set, but it's not really a natural choice; the more mathematically-oriented languages use ^. Obviously C-family languages don't have that possibility.

Re: opPow, opDollar

2009-11-07 Thread Robert Jacques
On Sat, 07 Nov 2009 10:48:11 -0500, KennyTM~ kenn...@gmail.com wrote: On Nov 7, 09 18:43, Don wrote: Walter Bright wrote: Don wrote: A little while ago I said I'd create a patch for ^^ as an exponentiation. A couple of people had requested that I make a post to the ng so they'd know when it

Re: opPow, opDollar

2009-11-07 Thread dsimcha
== Quote from Robert Jacques (sandf...@jhu.edu)'s article On Sat, 07 Nov 2009 10:48:11 -0500, KennyTM~ kenn...@gmail.com wrote: On Nov 7, 09 18:43, Don wrote: Walter Bright wrote: Don wrote: A little while ago I said I'd create a patch for ^^ as an exponentiation. A couple of people had

Re: opPow, opDollar

2009-11-07 Thread Pelle Månsson
dsimcha wrote: == Quote from Robert Jacques (sandf...@jhu.edu)'s article On Sat, 07 Nov 2009 10:48:11 -0500, KennyTM~ kenn...@gmail.com wrote: On Nov 7, 09 18:43, Don wrote: Walter Bright wrote: Don wrote: A little while ago I said I'd create a patch for ^^ as an exponentiation. A couple of

Re: opPow, opDollar

2009-11-07 Thread Robert Jacques
On Sat, 07 Nov 2009 11:26:36 -0500, dsimcha dsim...@yahoo.com wrote: == Quote from Robert Jacques (sandf...@jhu.edu)'s article On Sat, 07 Nov 2009 10:48:11 -0500, KennyTM~ kenn...@gmail.com wrote: On Nov 7, 09 18:43, Don wrote: Walter Bright wrote: Don wrote: A little while ago I said I'd

Re: opPow, opDollar

2009-11-07 Thread Andrei Alexandrescu
dsimcha wrote: == Quote from Robert Jacques (sandf...@jhu.edu)'s article On Sat, 07 Nov 2009 10:48:11 -0500, KennyTM~ kenn...@gmail.com wrote: On Nov 7, 09 18:43, Don wrote: Walter Bright wrote: Don wrote: A little while ago I said I'd create a patch for ^^ as an exponentiation. A couple of

Re: opPow, opDollar

2009-11-07 Thread KennyTM~
On Nov 8, 09 00:15, Robert Jacques wrote: On Sat, 07 Nov 2009 10:48:11 -0500, KennyTM~ kenn...@gmail.com wrote: On Nov 7, 09 18:43, Don wrote: Walter Bright wrote: Don wrote: A little while ago I said I'd create a patch for ^^ as an exponentiation. A couple of people had requested that I

Re: opPow, opDollar

2009-11-07 Thread Andrei Alexandrescu
Robert Jacques wrote: I'd recommend rolling that into a basic statistics struct containing common single pass metrics: i.e. sum, mean, variance, min, max, etc. Well the problem is that if you want to compute several one-pass statistics in one pass, you'd have to invent means to combine these

Re: opPow, opDollar

2009-11-07 Thread Walter Bright
KennyTM~ wrote: Nice. Meanwhile, I'd like an opSum() operator (∑ range) as well. It's primarily about syntax sugar: reduce!(a+b)(range) is so ugly. In practice, the most important case is the sum from 1 to n, which is an extremely common operation. reduce!(a+b)(iota(1,n+1)) is horribly ugly

Re: opPow, opDollar

2009-11-07 Thread Andrei Alexandrescu
Walter Bright wrote: KennyTM~ wrote: Nice. Meanwhile, I'd like an opSum() operator (∑ range) as well. It's primarily about syntax sugar: reduce!(a+b)(range) is so ugly. In practice, the most important case is the sum from 1 to n, which is an extremely common operation.

Re: opPow, opDollar

2009-11-07 Thread Chad J
Andrei Alexandrescu wrote: Walter Bright wrote: KennyTM~ wrote: Nice. Meanwhile, I'd like an opSum() operator (∑ range) as well. It's primarily about syntax sugar: reduce!(a+b)(range) is so ugly. In practice, the most important case is the sum from 1 to n, which is an extremely common

Re: opPow, opDollar

2009-11-07 Thread dsimcha
== Quote from Robert Jacques (sandf...@jhu.edu)'s article I'd recommend rolling that into a basic statistics struct containing common single pass metrics: i.e. sum, mean, variance, min, max, etc. I've been wondering for a while if something like this is general enough for non-statisticians and

Re: opPow, opDollar

2009-11-07 Thread Mo Chen
Suppose we have a matrix library, I'd like to have two product operators, one is for matrix product, the other is for element wise product, just like what we do in matlab (A*B and A.*B). I'd like to save ** to that scenario. Btw I'm no Fortran user. ^^ is fine by me. On Sat, Nov 7, 2009 at 5:56

Re: opPow, opDollar

2009-11-07 Thread Don
Walter Bright wrote: KennyTM~ wrote: Nice. Meanwhile, I'd like an opSum() operator (∑ range) as well. It's primarily about syntax sugar: reduce!(a+b)(range) is so ugly. In practice, the most important case is the sum from 1 to n, which is an extremely common operation.

Re: opPow, opDollar

2009-11-07 Thread Don
Mo Chen wrote: Suppose we have a matrix library, I'd like to have two product operators, one is for matrix product, the other is for element wise product, just like what we do in matlab (A*B and A.*B). I'd like to save ** to that scenario. Btw I'm no Fortran user. ^^ is fine by me. The D

Re: opPow, opDollar

2009-11-07 Thread Walter Bright
Andrei Alexandrescu wrote: In order for everyone to air an informed opinion, a related question is: will loop fusion be allowed with function calls? Loop fusion currently only works with operators, and adding ^^ would allow: a[] = b[] ^^ 3; But with pow you can't do that: a[] = pow(b[], 3);

Re: opPow, opDollar

2009-11-07 Thread Don
Walter Bright wrote: Andrei Alexandrescu wrote: In order for everyone to air an informed opinion, a related question is: will loop fusion be allowed with function calls? Loop fusion currently only works with operators, and adding ^^ would allow: a[] = b[] ^^ 3; But with pow you can't do

Re: opPow, opDollar

2009-11-07 Thread Robert Jacques
On Sat, 07 Nov 2009 12:56:35 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: Robert Jacques wrote: I'd recommend rolling that into a basic statistics struct containing common single pass metrics: i.e. sum, mean, variance, min, max, etc. Well the problem is that if you want

Re: opPow, opDollar

2009-11-07 Thread Robert Jacques
On Sat, 07 Nov 2009 14:22:01 -0500, dsimcha dsim...@yahoo.com wrote: == Quote from Robert Jacques (sandf...@jhu.edu)'s article I'd recommend rolling that into a basic statistics struct containing common single pass metrics: i.e. sum, mean, variance, min, max, etc. I've been wondering for a

Re: opPow, opDollar

2009-11-07 Thread Robert Jacques
On Sat, 07 Nov 2009 13:37:33 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: Walter Bright wrote: KennyTM~ wrote: Nice. Meanwhile, I'd like an opSum() operator (∑ range) as well. It's primarily about syntax sugar: reduce!(a+b)(range) is so ugly. In practice, the most

Re: opPow, opDollar

2009-11-07 Thread Andrei Alexandrescu
Robert Jacques wrote: On Sat, 07 Nov 2009 12:56:35 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: Robert Jacques wrote: I'd recommend rolling that into a basic statistics struct containing common single pass metrics: i.e. sum, mean, variance, min, max, etc. Well the

Re: opPow, opDollar

2009-11-07 Thread dsimcha
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article Robert Jacques wrote: On Sat, 07 Nov 2009 12:56:35 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: Robert Jacques wrote: I'd recommend rolling that into a basic statistics struct containing

Re: opPow, opDollar

2009-11-07 Thread Andrei Alexandrescu
dsimcha wrote: == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article Robert Jacques wrote: On Sat, 07 Nov 2009 12:56:35 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: Robert Jacques wrote: I'd recommend rolling that into a basic statistics struct

Re: opPow, opDollar

2009-11-07 Thread Stewart Gordon
Andrei Alexandrescu wrote: Matti Niemenmaa wrote: Don wrote: Yes, ^^ hasn't been used for exponentiation before. Fortran used ** because it had such a limited character set, but it's not really a natural choice; the more mathematically-oriented languages use ^. Obviously C-family languages

Re: opPow, opDollar

2009-11-07 Thread Phil Deets
On Sat, 07 Nov 2009 13:37:33 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: In order for everyone to air an informed opinion, a related question is: will loop fusion be allowed with function calls? Loop fusion currently only works with operators, and adding ^^ would

Re: opPow, opDollar

2009-11-07 Thread Phil Deets
On Sat, 07 Nov 2009 21:31:46 -0500, Phil Deets pjdee...@gmail.com wrote: On Sat, 07 Nov 2009 13:37:33 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: In order for everyone to air an informed opinion, a related question is: will loop fusion be allowed with function calls?

Re: opPow, opDollar

2009-11-07 Thread Robert Jacques
On Sat, 07 Nov 2009 16:53:01 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: Robert Jacques wrote: On Sat, 07 Nov 2009 12:56:35 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: Robert Jacques wrote: I'd recommend rolling that into a basic statistics struct