Created
May 18, 2020 16:58
-
-
Save fetburner/616516d41bdc6e0c1de557d1c54cb527 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
(* チャーチ数 *) | |
type church_nat = { nat_fold : 'a. ('a -> 'a) -> 'a -> 'a } | |
(* チャーチエンコーディングした二進数 *) | |
type church_bin = { bin_fold : 'a. f0:('a -> 'a) -> f1:('a -> 'a) -> 'a -> 'a } | |
(* チャーチ数nを受け取って, | |
n.nat_fold succ 1 | |
= m.bin_fold ~f0:(fun x -> 2 * x) ~f1:(fun x -> 2 * x + 1) 1 | |
が成り立つような二進数mを返す関数church_bin_of_church_natを記述せよ. *) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment