Created
December 16, 2016 13:52
-
-
Save Gbury/fec6604b2bd11e62bd481d9d1126660d to your computer and use it in GitHub Desktop.
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
let fix f x = | |
match f x with | |
| `Ok -> Gen.singleton x | |
| `Gen gen -> | |
let s = Stack.create () in | |
Stack.push gen s; | |
let rec aux () = | |
if Stack.is_empty s then None | |
else begin | |
let g = Stack.top s in | |
match g () with | |
| Some y -> y | |
| None -> | |
let _ = Stack.pop s in | |
aux () | |
end | |
in | |
aux |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment