Josef Eschgfaeller on Fri, 22 Aug 2014 17:24:38 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Syntax for inner function


T (a,v) = apply(i->v[i+1],a)

a=[0,1,1,0,0,1]; v=[8,9]
w=T(a,v); print(w) \\ [8, 9, 9, 8, 8, 9]

S (a,v) = {my (t);
t(i)=v[i+1]; apply(t,a)}

w=S(a,v); print(w)
\\ (i)->my(a=[0, 1, 1, 0, 0, 1],v=[8, 9],t=0);v[i+1];apply(t,a)

S should do the same thing as T.
What is wrong? Is it possible to define an inner function t?

Thanks
Josef Eschgfaeller