Without parens, *:@:+/ is interpreted as (*:@:+)/. You need to say *:@:(+/).
The various forms of display can be helpful. On the main menu,
Edit|Config|Display Form. If all display forms are selected, you get:
sqsum =: *: @: +/
sqsum
*:@:+/
┌─────────┬─┐
│┌──┬──┬─┐│/│
││*:│@:│+││ │
│└──┴──┴─┘│ │
└─────────┴─┘
┌─ *:
── / ─── @: ─┴─ +
(*:@:+)/
sqsum1 =: *: @: (+/)
sqsum1
*:@:(+/)
┌──┬──┬─────┐
│*:│@:│┌─┬─┐│
│ │ ││+│/││
│ │ │└─┴─┘│
└──┴──┴─────┘
┌─ *:
── @: ─┴─ / ─── +
*:@:(+/)
On Tue, Nov 8, 2011 at 4:36 PM, Don Nguyen <[email protected]> wrote:
> I have the following function
> sqsum =: *: @: +/
> When I use it as follows
> sqsum 1 2 3
> It produces 676 whereas the correct output should be
> *: (+/ 1 2 3)
> =36
> What have I done wrong?
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm