Created
December 18, 2013 01:53
-
-
Save djhaskin987/8016110 to your computer and use it in GitHub Desktop.
Chris Okasaki's "Purely Functional Data Structures", Chapter 2 Excercises
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
(* Excercise 2.1 | |
* We proceed by induction. | |
* If 'lst' is an empty list, we simply return lst itself. | |
* If 'lst' is a non-empty list, we store the pointer to the tail of the list, | |
* plus any pointers stored by a recursive call to suffixes. | |
* [] | |
*) | |
let rec suffixes lst = | |
match lst with | |
[] -> lst | |
| _ -> let tail = (List.tl lst) in | |
tail :: (suffixes tail);; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment