I've started learning Haskell by following along the CIS 194 Course from UPenn. In the first lessons there is talk about wholemeal programming and certain ways idiomatic Haskell code looks like. Now, I think that my style is still far away from being idiomatic and I don't think I've grasped what wholemeal means. To see how far away, I'd like some comments on code from the third assignment because that's where I struggled most (until now).
So, how far away from being idiomatic is the code? How's efficiency?
Exercise 1: skips :: [a] -> [[a]]
The nth list in the output should contain every nth element from the input list. For example, skips "hello!" == ["hello!", "el!", "l!", "l", "o", "!"]
.
skips :: [a] -> [[a]]
skips list =
let pos 1 l = l
pos i lst =
let tmp = drop (i-1) lst
in case tmp of
[] -> []
x:xs -> x : (pos i xs)
tmpSkps i acc lst = if i == (length lst)+1
then acc
else tmpSkps (i+1) ((pos i lst):acc) lst
in reverse (tmpSkps 1 [] list)