Your goo
function is drop
with flipped arguments. Given that, you can implement foo
almost like you say in your question:
let foo list spacing = zip list (drop spacing list)
This still doesn't exactly give the result you need though, but close:
Prelude> foo "abcdef" 3
[('a','d'),('b','e'),('c','f')]
EDIT:
Reading more carefully, your goo
function is splitAt
with flipped arguments. Given that, foo
can be defined like this:
let foo list spacing = (uncurry zip) $ splitAt spacing list
Which is the same as:
let foo list spacing = let (left, right) = splitAt spacing list
in zip left right