-
Function composition using common argument
Hi,
Newbie question I guess. To simplify, say I have 2 functions f1 & f2:
q) f1: {1-x%y} q) f2: {mavg[x;y]} /This is voluntary
which actually in this case, have a common argument when a composition <g> is applied, eg. :
q) a: til 10 q) g: f1 . (f2 . (3;a); a) 0n 0.5 0.5 0.3333333 0.25 0.2 0.1666667 0.1428571 0.125 0.1111111
I can’t figure a compact/elegant way to specify <g> without repeating twice argument <a>.
A wrapper function can obviously do the job, though complexity grows with the number of compositions. So the question is basically: Is there an iterative (or other) way to pass an identical argument to any number of multivalent functions composed successively?
Thx
Log in to reply.