[Haskell-beginners] Alphanumerical input

A. Mc. 47dragonfyre at gmail.com
Sat Mar 6 05:31:23 UTC 2021


Hello,

I was wondering what the best way was for tranforming a list of
alphanumerical characters from main IO() such as:

Enter String:
A 101 E 182

and tranforming it into an Int list of

[0, 101, 4, 182]

Which converting A and E to 0 and 4 is easy enough with toEnum/fromEnum and
simple subtraction, and using read can convert to a [Char], but recognizing
101 as a single Int from a Char string in main, and getting both converted
together as part of the same function, I'm a bit less sure of without
resorting to much lower level imperative methods.

Thanks in advance and thank you for your time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20210305/a6de6996/attachment.html>


More information about the Beginners mailing list