Polymorphism with Two Type Variables
fun swap(x,y) = (y,x);
val swap = fn : 'a * 'b -> 'b * 'a
swap(1, "One");
val it = ("One", 1) : string * int
swap(2.0, 3.0);
val it = (3.0, 2.0) : real * real
Previous slide
Next slide
Back to first slide
View graphic version