+ 12
Clear, nice and everything ok, but no one explains practical use!Look at the code. It's a little changed.
3 Answers
+ 6
All they are trying to teach is possibilities. Practical use isn't their concern. If you know what can be done and have a practical usage for it, you will be able to solve it. It is a hugely powerful pattern matching syntax. I've never used some things I've learned. However, I have always been able to uniquely select my target strings and process them the way I want. That is the goal of the lesson. Make you understand the possibilities so you too can always solve your practical problems.
+ 2
For this specific code, there is very little practical use. The idea is the concept of pattern matching though, and that is useful all over the place. Validating email or phone numbers, finding patterns of text in large strings, etc. Lots of uses.
+ 1
The practical use of that code is to inspire people to watch the associated Monty Python sketch:
https://www.youtube.com/watch?v=anwy2MPT5RE
Enjoy! :-)