Skip to content

Instantly share code, notes, and snippets.

@cls cls/cartesian.hs
Created Feb 21, 2017

Embed
What would you like to do?
Cartesian product over lists
cartesian :: [[a]] -> [[a]]
cartesian [] = [[]]
cartesian (xs:zss) = [x:ys | x <- xs, ys <- cartesian zss]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.