Skip to content

Instantly share code, notes, and snippets.

@keiichiw
Created May 26, 2015 20:32
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 keiichiw/5f20ed87e7c86edb85ed to your computer and use it in GitHub Desktop.
Save keiichiw/5f20ed87e7c86edb85ed to your computer and use it in GitHub Desktop.
空腹関数(iso-recursive, equi-recursive)
let rec fix f x = f (fix f) x;;
(* hungry function *)
(* iso-recursive *)
type iso_hungry = Hungry of (int -> iso_hungry);;
let iso_hungryfun = Hungry (fix (fun f n-> Hungry f));;
(* equi-recursive *)
#rectypes;;
type equi_hungry = int -> equi_hungry;;
let equi_hungryfun = (fix (fun (f:equi_hungry) n -> f));;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment