Don,

Would you settle for

   mean =: '(+/y) %  #y' function

   mean 1 2 2 4 6
3

   stddev2 =: '%: (% <:#y) * +/ *: y - (+/y) %  #y' function

   stddev2 1 2 2 4 6
2

?

This is close to how people talk: "the sin of 2x function" , we say:

   load 'trig'

   f =: 'sin 2*y' function
   f pi%4
1

Here is the definition of "function"

   function =: 1 : 0
3 : m
)


Kip Murray


Don Watson wrote:
(snip)
All I really want is a mode in which I can remove the surrounding material and just write:

mean=: (+/y) %  #y
ssdev=: +/ *: y - mean y
var=: (ssdev y) % <:#y
stddev=: %: var y
stddev2=: %: (% <:#y) * +/ *: y - (+/y) %  #y

That's not a lot to ask. I'll give up on replacing the x and y with [ and ].

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to