On 5/20/07, Terrence Brannon <[EMAIL PROTECTED]> wrote:
But the specs say we must write 4 separate functions and I am just the
one to try.

But they do not say any of those functions must refer to any of
the others  (I haven't looked at this enough to know if that matters.)

u = 3 $ 1

I get a value error on u, unless I change = to =:

eval_A =: 4 : '% (x + 1 + (x+y) * (x+y+1) % 2)'

eval_A_times_u =: 3 : 0
r    =. ''
for_i. y do.
 list =. 0
 for_j. y do.
   list =: list , ( (i eval_A j) * j )
 end.
 r =: r , (+/ list)
end.
r
)

eval_A_times_u u
|domain error: eval_A_times_u
|   list    =:list;((i eval_A j)*j)

You are getting a domain error on your assignment -- list is
a local name, and you are trying to assign to the global value.

If you really wanted to do that, you could use
 ".'list =: list, j * i eval_A j'

But this would mean that the local value of list (0) would
shadow the global value -- I'm pretty sure that's not what
you want.

When I traced this, it threw a value error on the input value of u...
any idea why?

Yes, if it's for the reason I got a value error on u.

Anyways, = =. and =: are three different things.

--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to