Newsgroups: comp.lang.apl
Path: watmath!watserv2.uwaterloo.ca!mach1!torn!howland.reston.ans.net!usc!cs.utexas.edu!uunet!olivea!hal.com!decwrl!csus.edu!sfsuvax1.sfsu.edu!vpcsc4
From: vpcsc4@sfsuvax1.sfsu.edu (Emmett McLean)
Subject: Re: fractions 
Message-ID: <1993Jun2.070908.27140@csus.edu>
Sender: news@csus.edu
Organization: San Francisco State University
Date: Wed, 2 Jun 1993 07:09:08 GMT
Lines: 31


Eugene McDonnell has suggested the following alternative to
the fraction verb I posted:

$ 
$ /usr/s3/emclean/x/j
J6.2   Copyright (c) 1990-1992, Iverson Software Inc.  All Rights Reserved.

   9!:3 (5)

   frac =.(<@(,%+.)&1)"0
   s =. ,~ $ (4 _1&,)@(,&_1)@(-&2 # 0:)
   ] b =. %. s 5
  0.267949  0.0717949 0.0192308 0.00512821 0.00128205
 0.0717949   0.287179 0.0769231  0.0205128 0.00512821
 0.0192308  0.0769231  0.288462  0.0769231  0.0192308
0.00512821  0.0205128 0.0769231   0.287179  0.0717949
0.00128205 0.00512821 0.0192308  0.0717949   0.267949
   frac b
+-------+------+-----+------+-------+
|209 780|14 195|1 52 |1 195 |1 780  |
+-------+------+-----+------+-------+
|14 195 |56 195|1 13 |4 195 |1 195  |
+-------+------+-----+------+-------+
|1 52   |1 13  |15 52|1 13  |1 52   |
+-------+------+-----+------+-------+
|1 195  |4 195 |1 13 |56 195|14 195 |
+-------+------+-----+------+-------+
|1 780  |1 195 |1 52 |14 195|209 780|
+-------+------+-----+------+-------+
   
