ok, audience, after some effort, we now have a hexadecimal to decimal
function.
htd=:16&#.@:('0123456789ABCDEF'&i.)
htd 'FFF'
4095
Now we would like to have a decimal to hexadecimal one, to "reverse the
operation".
We could sit and work hard to write it. BUT wait, we don't need to!! We
ask J to get the inverse!
htd inv 4095
FFF
inv
^:_1
]a=:htd inv 4095 4096 31 15
0FFF
1000
001F
000F
htd a
4095 4096 31 15
There is no definition of a dth function.
dth
|value error: dth
Sometimes you don't need to write the program! J does it silently. How cool!
===
To Jers
The inverse is sometimes very useful.
16&#: 4095
15
16&#. inv 4095
15 15 15
~ Gilles
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm