Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
37
Task/Nested-function/ATS/nested-function.ats
Normal file
37
Task/Nested-function/ATS/nested-function.ats
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
(* ****** ****** *)
|
||||
//
|
||||
#include
|
||||
"share/atspre_staload.hats"
|
||||
//
|
||||
(* ****** ****** *)
|
||||
|
||||
fun
|
||||
MakeList
|
||||
(
|
||||
sep: string
|
||||
) : void = let
|
||||
//
|
||||
var count: int = 0
|
||||
//
|
||||
val count =
|
||||
$UNSAFE.cast{ref(int)}(addr@count)
|
||||
//
|
||||
fun
|
||||
MakeItem
|
||||
(
|
||||
item: string
|
||||
) : void = let
|
||||
val () = !count := !count+1
|
||||
in
|
||||
println! (!count, sep, item)
|
||||
end // end of [MakeItem]
|
||||
//
|
||||
in
|
||||
MakeItem"first"; MakeItem"second"; MakeItem"third"
|
||||
end // end of [MakeList]
|
||||
|
||||
(* ****** ****** *)
|
||||
|
||||
implement main0() = { val () = MakeList". " }
|
||||
|
||||
(* ****** ****** *)
|
||||
Loading…
Add table
Add a link
Reference in a new issue