Just started learning Haskell a few days ago and I’ve come across a few issues. The first issue deals with printing a list of numbers. The desired behavior is as follows:
input: [1,2,3,4,5,6]
output: 1 2 3 | 4 5 6
So its a simple concept, I just need to output the elements of a list with the “|” symbol inserted between every three numbers, but I can’t for the life of me figure it out. It seems like most of the stuff I’ve tried involves strings and even if I were able to get the list to strings such as [“1”, “2”, “3”, …] all the methods I’ve tried print the numbers each on their own line which is not what I need.
Any help would be greatly appreciated.
Using the split package (recently added to the Haskell Platform):
Relevant documentation:
chunksOf,unwords,intercalate.