Hello

Base M and N are given, which are any integer number between 2 and 16
inclusive. Do the base conversion on a given number(in string form)
from base M to base N.

My quick trial follows:

  d=:'0123456789ABCDEF'
  fromM=: [ #. d i. ]
  toN=:d {~ 13 : 'x&#. ^:_1 y'
  MN=: ([: {: [) toN ] fromM~ [: {. [

  16 2 MN 'FE'
11111110
  8 16 MN '732'
1DA


Could you propose a pure tacit version, or more elegant, shorter one?
I bet there are better ones than mine, as always.

June
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to