Skip to content

Instantly share code, notes, and snippets.

@JuanFdS
Created May 11, 2016 22:05
Show Gist options
  • Save JuanFdS/45add7706f531fd650cbbc026d6ed925 to your computer and use it in GitHub Desktop.
Save JuanFdS/45add7706f531fd650cbbc026d6ed925 to your computer and use it in GitHub Desktop.
Zip resuelto sin recursividad
zip''::[a]->[b]->[(a,b)]
zip'' = foldr group (\_ -> [])
where
group x f (y:ys) = (x,y):(f ys)
group _ _ [] = []
zip'::[a]->[b]->[(a,b)]
zip' l1 = snd.foldl sarasa (l1,[])
where
sarasa ([],acum) _ = ([],acum)
sarasa ((x:xs),acum) y = (xs,(x,y):acum)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment