fun gcd(a0, b0) = let val a = ref a0; val b = ref b0; in (while !b <> 0 do (a := !b; b := !a mod !b); !a) end; fun gcd(a0, b0) = let val a = ref a0; val b = ref b0; in (while !b <> 0 do let val r = !a mod !b in (a := !b; b := r) end; !a) end;