Re:How I grew to hate every computer language
by wsprague on Monday August 17, 2009 @02:16PM
(#768711)
I find that every computer language does one thing best (ML with pattern matching, Tk with quick GUIs, Perl with text, Python with object orientation, Java with .... never mind), but in most other respects falls short of some other computer language. The more languages I know, the more salient their respective shortcomings become, which makes me hate them all. So I sympathize.
[ Parent
| on HN ]
I think you've misunderstood my use of "pattern matching" in the post above. The way you've used it is a bit like saying "C is the best language for if statements".
A pattern match in ML is something like:
fun f 0 = <do something> | f 1 = <do something else> | f n = <do something in the general case
This goes really well with the ability to build up arbitrary datastructures, for example:
fun sum_tree (Node v) = v | sum_tree (Branch (left, v, right)) = v + sum_tree(left) + sum_tree(right)
Which would sum up all the values stored in an integer tree.