Skip to main content
Commonmark migration
Source Link

#Haskell, 97 bytes

Haskell, 97 bytes

import Data.Char
j x|x>64=x-54|1<2=x-47
l=j.ord
m=l.maximum
f x=(foldl(\a b->a*m x+l b-1)0 x,m x)

Example run:

*Main> map f ["HELLOWORLD", "POTATO", "1"]
[(809608041709942,33),(627732894,30),(1,2)]

It's so long because I need do import Data.Char for ord and I don't have a built in read function for integers of arbitrary base.

#Haskell, 97 bytes

import Data.Char
j x|x>64=x-54|1<2=x-47
l=j.ord
m=l.maximum
f x=(foldl(\a b->a*m x+l b-1)0 x,m x)

Example run:

*Main> map f ["HELLOWORLD", "POTATO", "1"]
[(809608041709942,33),(627732894,30),(1,2)]

It's so long because I need do import Data.Char for ord and I don't have a built in read function for integers of arbitrary base.

Haskell, 97 bytes

import Data.Char
j x|x>64=x-54|1<2=x-47
l=j.ord
m=l.maximum
f x=(foldl(\a b->a*m x+l b-1)0 x,m x)

Example run:

*Main> map f ["HELLOWORLD", "POTATO", "1"]
[(809608041709942,33),(627732894,30),(1,2)]

It's so long because I need do import Data.Char for ord and I don't have a built in read function for integers of arbitrary base.

Source Link
nimi
  • 35.9k
  • 4
  • 34
  • 99

#Haskell, 97 bytes

import Data.Char
j x|x>64=x-54|1<2=x-47
l=j.ord
m=l.maximum
f x=(foldl(\a b->a*m x+l b-1)0 x,m x)

Example run:

*Main> map f ["HELLOWORLD", "POTATO", "1"]
[(809608041709942,33),(627732894,30),(1,2)]

It's so long because I need do import Data.Char for ord and I don't have a built in read function for integers of arbitrary base.