Flix (programming language): Difference between revisions

Content deleted Content added
JorKadeen (talk | contribs)
JorKadeen (talk | contribs)
Line 81:
 
=== Parametric Polymorphism ===
 
The following program fragment illustrates a polymorphic function that maps a function <code>f: a -> b</code> over a list of elements of type <code>a</code> returning a list of elements of type <code>b</code>:
 
<syntaxhighlight lang="Scala">
def map(f: a -> b, l: List[a]): List[b] = match l {
...
case Nil => Nil
case x :: xs => f(x) :: map(f, xs)
}
</syntaxhighlight>
 
Flix supports type parameter elision hence the type parameters <code>a</code> and <code>b</code> are not required to be explicitly introduced.
 
=== Extensible Records ===