Clojure does it neatly! https://clojure.org/guides/destructuring
This example is taken directly from the book.
Now I wanted to see how other languages support this.
Scala has powerful pattern matching abilities for destructuring a list.
Scala’s pattern matching is so powerful that you can go further with it. For example you can find the second last element, or third last element and what ever is inbetween them.
As you know Ruby has this ability as well!
Python also does it beautifully.
Are you kidding me? :smile:
Author: Deepu Mohan Puthrote
This work by Deepu Mohan Puthrote is licensed under a Creative Commons Attribution 4.0 International License