Hi, Don,
A good way to investigate questions like yours is to paste the expression into the J window and
see what happens.
d1 =: ([: +/([ - ]) ^ 2) ^ 0.5
|domain error
| d1=:( [:+/([-])^2)^0.5
Here is a rough explanation of what happened:
When the interpreter, scanning from right to left, saw ^0.5, it checked to see whether there was
a left argument for ^ because ^0.5 by itself means e to the power 0.5, but 4^0.5 would mean 4 to
the power 0.5. Working inside the parentheses from right to left, the interpreter evaluated ^2
as e^2, ([ - ]) e^2 as 0, +/0 as 0 and gave a domain error for [: 0 because [: is a verb that
rejects all arguments.
The main point is that 0.5 triggered an attempt to evaluate, verbs 2"_ and 0.5"_ do not trigger
such attempts.
You said in another place "I really need to learn J." That was good advice, and we in the J
Forum are always ready to help.
Kip Murray (I wouldn't mind being Skip, but I'm Kip!)
Don Watson wrote:
HI Skip,
I see what you are saying. I assume you can't put constants in a tacit
expression as follows:.
d1 =: ([: +/([ - ]) ^ 2) ^ 0.5
Why is this? I can understand why named nouns aren't allowed, but not
why constants aren't.
Don
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm