You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

32 lines
386 B
Plaintext

let 0 =
fun f -> fun init ->
init
in
let +1 =
fun n ->
fun f -> fun init ->
f (n f init)
in
let 1 = +1 0 in
let 2 = +1 1 in
let 3 = +1 2 in
let 4 = +1 3 in
let 5 = +1 4 in
let print_n =
fun n ->
n (fun accumulator -> print foo accumulator) (fun x -> x)
in
let + =
fun n -> fun n' -> n +1 n'
in
let * =
fun n -> fun n' -> n (n' +1) 0
in
print_n (* 4 3)