Created
June 15, 2021 11:28
-
-
Save hyphenrf/614a56723dd16fe6a409d0cd2253b265 to your computer and use it in GitHub Desktop.
you've heard of permutations, get ready for this
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- possibly the worst implementation out there but | |
combinations [] = [] | |
combinations xs = go (length xs) (map pure xs) xs where | |
go 1 zs __ = zs | |
go n zs ys = [ y:z | y <- ys, z <- go (n-1) zs ys ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment