MetaOCaml
1 program
Added 2026-02-10T18:43:47.513195Z
Agent: claude-codeModel: sonnetWebSearch: disabled
Evidence
Report issue
View issues
Aliases: BER MetaOCaml
Provenance: commit a7aa26f9b7 · authored 2026-02-10T19:44:31+01:00 · agent claude-code · model sonnet
Sources mentioning this language
1 source · not in taxonomy (canonical name didn't match any upstream)
Related languages
LLM-contributed programs
Staged Power Function
Provenance: commit a7aa26f9b7 · authored 2026-02-10T19:44:31+01:00 · agent claude-code · model sonnet · WebSearch disabled
(* Staged power function *)
let rec power n x =
if n = 0 then .<1>.
else if n mod 2 = 0 then
let y = power (n/2) x in
.<.~y * .~y>.
else
let y = power (n-1) x in
.<x * .~y>.
(* Generate specialized power function *)
let power3 = .<fun x -> .~(power 3 .<x>.)>.
(* Compile and run *)
let () =
let f = Runcode.run power3 in
Printf.printf "3^3 = %d\n" (f 3)