Created
January 11, 2015 17:28
-
-
Save kik/ebaea54ac208af903094 to your computer and use it in GitHub Desktop.
初めてのATS2。見たとおりのCのコードにコンパイルされた
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "share/atspre_define.hats" | |
#include "share/atspre_staload.hats" | |
fn foo1(n : bool, dst : &int) : bool = | |
if n then ( | |
dst := 42; | |
true | |
) else ( | |
dst := 0; | |
false | |
) | |
implement main0 () = | |
let | |
var x : int = 0 | |
val y1 = foo1(true, x) | |
val () = println!("x = ", x, ", y1 = ", y1) | |
val y2 = foo1(false, x) | |
val () = println!("x = ", x, ", y2 = ", y2) | |
in | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment