Skip to content

Instantly share code, notes, and snippets.

@mneedham
Created April 26, 2011 06:39
Show Gist options
  • Save mneedham/941892 to your computer and use it in GitHub Desktop.
Save mneedham/941892 to your computer and use it in GitHub Desktop.
Purely Functional Data Structures - Chris Okasaki
let suffixesTR list =
let rec loop l acc =
match l with
| [] -> acc
| [last] -> loop [] (List.concat [acc; [[last]]; [[]]])
| hd::tl -> loop tl (List.concat [acc; [l]])
in
loop list []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment