J is unable to determine the inverse of f or h2d.

--- June Kim <[EMAIL PROTECTED]> wrote:

>    f=:[ #. '0123456789ABCDEF' i. ]
>    h2d=:16&f
>    h2d 'FF'
> 255
>    h2d^:_1 ] 255
> |domain error
> |       h2d^:_1]255
> 
> Why did domain error occur here? Are there rules
> that I am missing?
> 
> 2006/9/26, June Kim <[EMAIL PROTECTED]>:
> > 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&#65533;. ^:_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
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to