Last active
March 7, 2017 20:37
-
-
Save gallais/71a30a74e2d6090a75873a114f4ea14f to your computer and use it in GitHub Desktop.
Translating code from https://sebfisch.github.io/haskell-regexp/regexp-play.pdf
This file contains hidden or 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
open List | |
let bind (xs : 'a list) (f : 'a -> 'b list) : 'b list = | |
concat (map f xs) | |
let rec parts : 'a list -> 'a list list list = function | |
| [] -> [[]] | |
| [c] -> [[[c]]] | |
| c :: cs -> | |
bind (parts cs) (fun (p :: ps) -> | |
[(c :: p) :: ps; [c]::p::ps]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment