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

Reply via email to