Is there an easy way to change [Int] -> String
?
My output function returns a list of int but the format should be a string as in the example below
example: [1,2,3,4] -> 1 2 3 4
Is there an easy way to change [Int] -> String
?
My output function returns a list of int but the format should be a string as in the example below
example: [1,2,3,4] -> 1 2 3 4
To turn an integer into a string, use show
.
To turn a list of integers into a list of strings, use map show
.
To add " "
between every string in a list of strings, use intersperse " "
. (Requires import Data.List
)
To concatenate a list of strings, use concat
.
Alternative: try unwords ["a","b","c"]
in GHCi.