Created
June 24, 2015 21:59
-
-
Save davidallsopp/c26a44342586a0b04e19 to your computer and use it in GitHub Desktop.
dropEach - not original, probably taken from Stack Overflow somewhere. Returns all lists generated by removing one element from the input
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
Prelude> import Data.List | |
Prelude Data.List> let dropEach xs = zipWith (++) (inits xs)(tail $ tails xs) | |
Prelude Data.List> dropEach [1,2,3,4,5] | |
[[2,3,4,5],[1,3,4,5],[1,2,4,5],[1,2,3,5],[1,2,3,4]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment