Re: [q-lang-users] New stuff in cvs: multichar ops, views
Brought to you by:
agraef
From: Eddie R. <ed...@bm...> - 2007-05-31 13:47:57
|
Albert Graef, > John Cowan wrote: >> I always forget that -2 is the application of minus to 2 rather than a >> constant, so I write things like "foo -2", which then turns out to be >> "(foo -) 2". > > Well, syntactically the '-' in '-2' is a unary minus, although > semantically, it's still a number and not an explicit application of > minus. IMHO, that's the only reasonable way to implement it, since I > want '-2' and '-X' to be parsed in the same manner. Put this on a college Algebra or Calculus test: -2^2 = (a) -4 (b) 4 All most all of the students will put (b). This is the same gotcha that I have to point out to students all the time. Strange though, they have no problem with X=2, -X^2=-4. Sorry, I just had to toss in my 2 cents. Eddie |