Created
February 7, 2023 05:53
-
-
Save sgoguen/893358f063e216cacde14843d6ae663e to your computer and use it in GitHub Desktop.
Composing Total Recursive Functions
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
let composeRecursive baseF recursiveFs = | |
let funcs = [| (fun _ x -> baseF x); yield! recursiveFs |] | |
let length = bigint(Array.length funcs) | |
let rec natToObject n = | |
let r = int(n % length) | |
let recF = funcs[r] | |
let f = recF natToObject | |
f (n / length) | |
natToObject |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment