On Thu, Sep 29, 2011 at 12:26 AM, Christopher McIntosh <[email protected] > wrote:
> According to the Dictionary, u/ y "applies the dyad u between items of y" > > Indeed, +/ 1 2 3 4 5 returns the expected result of 15, the sum of the > first > five non-zero integers. > > How do I use / to get the result _13 (which is 1 - 2 - 3 - 4 - 5) when > applied to the list 1+i.5? > > I thought that I would simply apply it to the - dyad. But -/ 1 2 3 4 5 > returns 3 (1 - 2 + 3 - 4 + 5), which is alternating between subtraction and > addition. > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > You were expecting a left fold<http://en.wikipedia.org/wiki/Fold_%28higher-order_function%29>but J's Insert (/) folds right. There is this relevant stackoverflow question: http://stackoverflow.com/q/5208743/349708 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
