I do have the following code:
data List = Empty | Cons Integer List deriving Show
list = Cons 1 (Cons 7 (Cons 9 (Cons 3 Empty)))
Now I am writing a function that doubles every 2nd element in a list:
double2nd :: List -> List
double2nd Empty = Empty --If the list is empty, nothing to do
double2nd (Cons x y z) = ???
I have the following test case lined up:
testDouble = putStrLn ("expected: Cons 1 (Cons 14 (Cons 9 (Cons 6 Empty)))\ncomputed: " ++ show (double2nd list))
I tried looking up lists on various web pages but came to no conclusion.
Any help or any pages where I can learn that would be appreciated.