>>>>> "Robert" == Robert Dodier <robert.dodier at gmail.com> writes:
>> What is the correct way to define the function dgsub?
Robert> I would suggest dgsub(i, z) := subst('z = z, row(dg,
Robert> i)[1]).
dgsub(1,[1,2,3,4]) ->
[-2.0*(-[1,2,3,4][4]-[1,2,3,4][3]+0.1),1,2.0*[1,2,3,4][1],2.0*[1,2,3,4][1]]
The only way I could get that to evaluate down to a number was to use
(gasp!) ev.
Robert> ev has the right effect in this case, but it is easy for
Robert> unintended side effects to creep in. subst('z = ...)
Robert> affects only z, while ev can affect all variables and
Robert> function calls.
Yeah, I was hestitating to use ev here, but nothing else I tried
worked.
Anyway, I think it's time to use Barton's suggestions and get rid of
the subscripted variables.
Ray