On 2014.01.25 20:33:55, you,
 the extraordinary David Lambert, spake thus:

>    NB. convert 38 cents to pennies, nickels, dimes, quarters.
> 
>    38 #:~ COINS =: |. 1 5 2 5r2 2
> 1 1r2 1 3 0
> 
>    NB. why do I get a half dime and a nickel?
> 
>    COINS #. 1 1 0 3 0
> 38
> 

foo=. ((<.@:(%~)),|)
C=. 2 5r2 2 5


   5 foo 38
7 3
   2 foo 7
3 1
   5r2 foo 3
1 1r2
   2 foo 1
0 1

and the result of C #: 38 (tracing upward) is 1 1r2 1 3

   C#.1 1r2 1 3
38


-- 
Nollaig MacKenzie
http://www.yorku.ca/nollaig
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to