%&(+/)&:% 10 20 40 5.71429 (+/)&.:% 10 20 40 5.71429 Welcome Alex. The catch is to parenthesize (+/).
--- Den tors 4/2/10 skrev Alex Gian <[email protected]>: > Fra: Alex Gian <[email protected]> > Emne: [Jprogramming] A q for starters - composing without forking (% +/ %) > Til: [email protected] > Dato: torsdag 4. februar 2010 01.36 > Hi - complete newbie to J here. > Though I like what I've seen so far. > > Here's my starter question: > I'd like to code the function that gives the inverse of a > sum of > inverses (eg. like when calculating resistors in parallel) > > It works fine if I just write it out as > % +/ % 10 20 40 > (ans 5.71429) > > However, if I try to make a function of it, > invsuminv =. % +/ % > it becomes a fork (I guess that _does_ make sense), and > just computes > the "cross-sum" of the inverses, as if I'd typed > (% +/ %) 10 20 40 > 0.2 0.15 0.125 > 0.15 0.1 > 0.075 > 0.125 0.075 0.05 > > How can I avoid this? I've tried all sorts of combinations, > using @ and > & but can't seem to crack it. Obviously something > fundamental I'm not > grasping. Any help appreciated. > > > > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > __________________________________________________ Bruger du Yahoo!? Er du træt af spam? Yahoo!Mail har den bedste spambeskyttelse, der findes http://dk.mail.yahoo.com ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
