Skip to content

Instantly share code, notes, and snippets.

@jimexist
Created October 19, 2014 18:50
Show Gist options
  • Save jimexist/9e9985c4c720fdddbe57 to your computer and use it in GitHub Desktop.
Save jimexist/9e9985c4c720fdddbe57 to your computer and use it in GitHub Desktop.
subset n k
subset :: Int -> Int -> [[Int]]
subset 0 _ = [[]]
subset _ 0 = [[]]
subset n k = [i:y | i <- [k..n], y <- subset (i-1) (k-1)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment