I'm trying to zip two lists together but I cannot for the life of me figure out why it won't run the code. I have two lists declared as variables, and I've written a function to combine them together.
letters = ["a","b","c"]
numbers = ["1","2","3"]
comb :: [a] -> [b] -> [(a,b)]
comb _ [] = []
comb [] _ = []
comb (x:xs)(y:ys) = (x,y):comb xs ys
My hope here is that this code will recursively combine the pairs into tuples, but I'm very new to Haskell so I'm not even sure if what I've written is functional (the compiler doesn't complain about it).
My issue comes up when I try to run the code with this line,
comb letters numbers
and the compiler tells me "Parse error: module header, import declaration or top-level declaration expected." I'm not sure what I'm supposed to declare here. Can I please have some assistance?
comb letters numbers
expression in the middle of your file? – melpomene