Skip to content

Instantly share code, notes, and snippets.

@mp4096
Created February 23, 2018 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mp4096/ed40e3b7c322fcf64cf4c70a6e0effbe to your computer and use it in GitHub Desktop.
Save mp4096/ed40e3b7c322fcf64cf4c70a6e0effbe to your computer and use it in GitHub Desktop.
Cartesian product using folder
product xss = foldr f [[]] xss
where f xs yss = foldr g [] xs
where g x zss = foldr h zss yss
where h ys qss = (x : ys) : qss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment