Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
24
Task/Y-combinator/ATS/y-combinator.ats
Normal file
24
Task/Y-combinator/ATS/y-combinator.ats
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
(* ****** ****** *)
|
||||
//
|
||||
#include "share/atspre_staload.hats"
|
||||
//
|
||||
(* ****** ****** *)
|
||||
//
|
||||
fun
|
||||
myfix
|
||||
{a:type}
|
||||
(
|
||||
f: lazy(a) -<cloref1> a
|
||||
) : lazy(a) = $delay(f(myfix(f)))
|
||||
//
|
||||
val
|
||||
fact =
|
||||
myfix{int-<cloref1>int}
|
||||
(
|
||||
lam(ff) => lam(x) => if x > 0 then x * !ff(x-1) else 1
|
||||
)
|
||||
(* ****** ****** *)
|
||||
//
|
||||
implement main0 () = println! ("fact(10) = ", !fact(10))
|
||||
//
|
||||
(* ****** ****** *)
|
||||
Loading…
Add table
Add a link
Reference in a new issue