Re: [q-lang-users] New stuff in cvs: multichar ops, views
Brought to you by:
agraef
From: Rob H. <hub...@gm...> - 2007-06-26 21:50:26
|
Hello Albert and all, Here's what the new complex operators do in Q7.7: ==> (1+:2) * (3+:4) -5+:10 ==> 1 +: (2*3) +: 4 1+:10 ==> 1+:2 * 3+:4 1+:10 I think that the last here is the wrong result. Could the precedence of (+:) be raised? I think that (+:) should bind more tightly even than (^) exponentiation, so perhaps it should have the precedence of (.) function composition. On the subject of (+:), I wondered whether there could be another operator (-:) having the meaning "-i*", just as (+:) has meaning "+i*". Then rather that this: ==> 5 - sqrt (-16) 5.0 +: -4.0 the result would be ==> 5 - sqrt (-16) 5.0-:4.0 which looks closer to "5.0 - i 4.0", and is I think prettier. > But beware that Python doesn't really get this quite right: > > >>> (1+2j) * (3+4j) > (-5+10j) > > >>> 1 + (2j*3) + 4j > (1+10j) > > >>> 1+2j * 3+4j > (1+10j) Thanks, Rob. |