Skip to content

Instantly share code, notes, and snippets.

@camilopayan
Created February 22, 2010 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save camilopayan/311101 to your computer and use it in GitHub Desktop.
Save camilopayan/311101 to your computer and use it in GitHub Desktop.
let rec separate = function
| [] -> ([],[])
| []::xs -> ([],[])
| (x::xs)::ys -> let (M,N) = separate ys
(x::M, xs::N)
let rec trans = function
| [] -> []
| x::xs -> let (q, w) = separate (x::xs) in
if List.length(q) = 0 then [] else [q] @ trans w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment