Algebraic data types: Difference between revisions

Content added Content deleted
(→‎{{Header|E}}: Removed a superfluous comments : pattern factorisation is not unusual, OCaml does the same)
m (Moved to Data struct cat)
Line 1: Line 1:
[[Category:Less Than 5 Examples]]{{task}}
[[Category:Less Than 5 Examples]]{{task|Data Structures}}
[[Category:Data Structures]]


Some languages offer direct support for [http://en.wikipedia.org/wiki/Algebraic_data_type algebraic data types] and pattern matching on them. While this of course can always be simulated with manual tagging and conditionals, it allows for terse code which is easy to read, and can represent the algorithm directly.
Some languages offer direct support for [http://en.wikipedia.org/wiki/Algebraic_data_type algebraic data types] and pattern matching on them. While this of course can always be simulated with manual tagging and conditionals, it allows for terse code which is easy to read, and can represent the algorithm directly.