Haskell int list to String -


i know if there simple way turn [5,2,10] "52a". not case, want associate number >9 corresponding letter.

thanks in advance.

you want each element of list in order new list. in other words, want apply function (that have define yourself) each element. map function prelude for.

to convert between integers , individual characters, use chr , ord functions data.char module.

so,

map (\i -> if < 10 chr (i + ord '0') else chr (i - 10 + ord 'a')) 

is function of type [int] -> string want (no error checking included, though).


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -