2 x: 4r6
2 3
See x: in dictionary.
Regards Rob.
On 04/03/2009, at 3:00 PM, Brian Schott wrote:
> How do you get the numerator and denominator of a
> rational fraction? For example the (numerator,denominator)
> of 4r6 is 2 3; how do you get the 2 3 from 4r6? I know this
> must have been covered before, but I cannot think how to
> search for it.
>
> My current best effort is the verb ratio.
> ratio =: 2{.!.1 (i.&'r' ( {./ , ' ' , ] }.~ #...@] <. >:@[) ])&.":
> ratio 4r6
> 2 3
> ratio 4
> 4
> $ratio 4
>
> $ratio 4r6
> 2
> #ratio 4
> 1
> #ratio 4r6
> 2
> ratio"0 ]4r6 6r4 79
> 2 3
> 3 2
> 79 1
>
>
> --
>
> (B=)
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm