What a nice exposition, I hope taken in good spirit! In general, it is the main thing I have always liked most about APL and J - that is, when there is something I want to do, I think about it and try my suspicion. More often than not, it does what I suspected/expected.
This is the opposite in any other computer language I know of .... there is no alternative to looking it up in a fat manual - many times with lots of examples because the action is contrary to (my) intuition... - joey At 19:21 -0500 2010/03/08, Dan Bron wrote: >David Ward Lambert wrote: >> I'd like to convert rational to float. What, please, is a better way? >> 1.001 * 2r5 NB. unsatisfying. > >Since x: 2%5 converts 0.4 to 2r5 we might expect that (x:^:_1) 2r5 >would convert 2r5 to 0.4 : > > (x:^:_1) 2r5 > 0.4 > >and indeed it does. Moreover, since we know the dyad x: accepts a range >of "function codes" as right arguments, which apply useful transformations >to its left argument, we might suspect it provides one for this kind of >transformation. For mnemonic reasons, we might even expect this function >code to be _1 (to invoke the concept of inversion): > > _1 x: 2r5 > 0.4 > >and indeed it is. Of course, this latter was just a suspicion; we could've >canonically confirmed it by reading the definition of the dyad x: : > > http://www.jsoftware.com/help/dictionary/dxco.htm > >-Dan ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
