[Jprogramming] #: antibase

Nollaig MacKenzie nollaig at amhuinnsuidhe.net
Sun Jan 26 05:53:28 UTC 2014


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


More information about the Programming mailing list