Adobe PDF
Adobe PDF
Adobe PDF
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Polymorphism - Parametric<br />
Consider the type of a sort function.<br />
sort : IntList IntList<br />
Generalize this to<br />
sort : Forall(Y) List(Y) List(Y)<br />
But what about the comparison operation on<br />
elements of Y?<br />
That would be of the form<br />
compare : Y x Y Bool for any Y.<br />
So, sort will take an additional argument: the<br />
function compare.<br />
sort : Forall(Y) List(Y) x (Y x Y Bool) List(Y)<br />
4/11/2008 Sundar B., BITS, Pilani. CS C362 12