A function takes a single number (it could be int , uint , llint , etc)
and divides it with number 10 and return the result . What is the idomatic
way to write such function in ATS.
fun{a : t@ype} test (n : a) : a = let
val v = div (n , cast{a}(10))
//val v = n / cast{a}(10)
in v end
implement main0 () = {
val i = 100 : int
val li = 100l : lint
val lli = 100ll : llint
val ui = 100u : uint
val ul = 100ul : ulint
val ull = 100ull : ullint
val () = println! (test (i))
val () = println! (test (ui))
On Saturday, July 5, 2014 2:47:34 AM UTC-4, Chotu S wrote:
A function takes a single number (it could be int , uint , llint , etc)
and divides it with number 10 and return the result . What is the idomatic
way to write such function in ATS.
fun{a : t@ype} test (n : a) : a = let
val v = div (n , cast{a}(10))
//val v = n / cast{a}(10)
in v end
implement main0 () = {
val i = 100 : int
val li = 100l : lint
val lli = 100ll : llint
val ui = 100u : uint
val ul = 100ul : ulint
val ull = 100ull : ullint
val () = println! (test (i))
val () = println! (test (ui))
A function takes a single number (it could be int , uint , llint , etc)
and divides it with number 10 and return the result . What is the idomatic
way to write such function in ATS.
fun{a : t@ype} test (n : a) : a = let
val v = div (n , cast{a}(10))
//val v = n / cast{a}(10)
in v end
implement main0 () = {
val i = 100 : int
val li = 100l : lint
val lli = 100ll : llint
val ui = 100u : uint
val ul = 100ul : ulint
val ull = 100ull : ullint
val () = println! (test (i))
val () = println! (test (ui))