Generic function: Difference between revisions

Content deleted Content added
Cydebot (talk | contribs)
m Robot - Moving category Method (computer science) to Category:Method (computer programming) per CFD at Wikipedia:Categories for discussion/Log/2012 November 8.
The alleged OCaml code was syntactically invalid; fixed this.
Line 50:
Another, completely separate definition of '''generic function''' is a function that uses [[Type_polymorphism#Parametric_polymorphism|parametric polymorphism]]. This is the definition used when working with a language like [[OCaml]]. An example of a generic function is
<source lang="ocaml">
let id : 'a -> 'a = fun x -> x
let id a = a
</source>
which takes an argument of any type and returns something of that same type.