Thank you to everyone for your replies. I have taken the advice of the first response and am trying both, starting with q.
On tacit programming, i think i have found it is possible in q, and it does have currying. They have default (implicit?) arguments x and y to refer to the first and second args in a monad/dyadic function. similar to j's [ and ] operators? So by my reckoning this code below is an example of tacit average in q? q) is the prompt... q)average:{ (sum x) % count x} q)average[2 3 4] 3f q)average[2 3 4 5] 3.5 hope my other three questions are as easy to figure out... On 17 January 2012 00:59, Boyko Bantchev <boyk...@gmail.com> wrote: > On 16 January 2012 18:11, Kim Kuen Tang <kuent...@vodafone.de> wrote: > > > > I tried to calculate the mean in K using tacit programming. > > (+/%# ) !10 > > But it is not working. Can you show how to program it in K? > > There are no forks like +/%# in K. Instead, you can do: > avg: %/(+/;#:)@\: > avg 2 3 7 > 4.0 > avg' (2 3 7; 5 6) > 4 5.5 > > Or, you can define a `fork' yourself: > fork: {[f;g;h;x] g[f[x];h[x]]} > which itself is non-tacit, but allows tacit definitions such as: > avg: fork[+/;%;#:;] > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm