How to convert list of numbers to list of strings(one string = one number from list) in Haskell.
[Int] -> [String]
Examples: [1,2,3,4] -> ["1","2","3","4"]
If you have a function f :: a -> b
, then map f :: [a] -> [b]
applies f
on all the list elements.
The function show
can convert "printable" types in their string representation. In particular, one of the possible types for show
is Int -> String
.
Use both tools.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With