4 ms·
But, this has really not a lot to do with pattern matching. Please see my comment at https://www.reddit.com/r/perl6/comments/bvhzwh/perl_6s_given_switch_on_ste
by lizmat 7y ago
But, this has really not a lot to do with pattern matching. Please see my comment at https://www.reddit.com/r/perl6/comments/bvhzwh/perl_6s_given_switch_on_steroids_matéu/eppm0oz/ https://www.reddit.com/r/perl6/comments/bvhzwh/perl_6s_given...
- agumonkey 7y agothe condition tree flattening reminds me of pattern matching compilation though
- Sharlin 7y agoSurely it has everything to do with pattern matching? A C-style switch statement is an extremely primitive version of pattern matching, and in the article the flattened equivalent of the nested switch structure is just tuple destructuring and matching, just like in Rust I could write match (foo, bar, baz) { (1, 2, 3) => something(), (3, 2, 1) => somethingelse() }
- nemetroid 7y agoFrom that explanation, it sounds very similar to pattern matching in general, and Erlang's case statement in particular. Would you care to elaborate?