Created
September 15, 2016 19:23
-
-
Save gsg/83a224b338ef07c552d17fe8f620557c to your computer and use it in GitHub Desktop.
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
module LazyFix = struct | |
let rec fix f = f (lazy (fix f)) | |
let f_open = fun clo (x : int) -> | |
if x <= 0 then x else (snd (Lazy.force clo)) (x - 1) | |
let g_open = fun clo (x : int) -> | |
if x <= 0 then x else (fst (Lazy.force clo)) (x - 1) | |
let clo = fix (fun clo -> f_open clo, g_open clo) | |
let f = fst clo | |
let g = snd clo | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment