Here, let us use the compiler! For sake of readability, we abbreviate
fold
and
unfold
.
let
( ! )
f
=
fold
f
and
(
@
)
a1
a2
=
unfold
a1
a2
;;
let
fix
=
!(
fun
f
' ->
!(
fun
f
-> !(
fun
x
->
f
'
@
(
f
@
f
)
@
x
))
@
!(
fun
f
-> !(
fun
x
->
f
'
@
(
f
@
f
)
@
x
))
);;