let var x := 1 var y := 2 function g(x:int, y:string) : int = (print(y); x+5) function factorial(n:int) : int = /* you didn't really think ... */ if (n<2) then 1 else n*factorial(n-1) function swap(a:int, b:int) = let var temp := 0 in ( temp := deref(a); refassign(a, deref(b)); refassign(b, temp) ) end in ( let var x := x+1 /* watch out here! */ in x := x + 2 end; if (x=4) then print("it didn't work!") else if (x=1) then print("it worked!"); x := g(x,"hello") + 9000; /* large constant test */ swap(ref(x),ref(y)); if (y > 2) then print("referencing works!"); let var n := 5 in if (factorial(n)=120) then print("the factorial of 5 is indeed 120!") else print("something weird happened.") end ) end