Pattern matching: Difference between revisions

Content deleted Content added
Update content page
Tags: Reverted Mobile edit Mobile web edit
TobyK (talk | contribs)
Line 66:
The creations of these functions can be automated by Haskell's data [[Record (computer science)|record]] syntax.
 
This [[Ocaml]] example which defines a [[Red–black tree|red-black tree]] and a function to re-balance it after element insertion shows how to match on a more complex structure generated by a recursive data type. The compiler verifies at compile-time that the list of cases is exhaustive and none are redundant.
 
<syntaxhighlight lang="ocaml">