RosettaCodeData/Task/Named-parameters/Standard-ML/named-parameters-3.ml
2016-12-05 22:15:40 +01:00

12 lines
256 B
Standard ML

datatype param = A of string | B of real | C of int
fun args xs =
let
(* Default values *)
val a = ref "hello world"
val b = ref 3.14
val c = ref 42
in
map (fn (A x) => a := x | (B x) => b := x | (C x) => c := x) xs;
(!a, !b, !c)
end