Hacker News new | ask | show | jobs
by bmn__ 1511 days ago
You have misunderstood GP.

Alternating functions and regexps looks like this:

    [\&some_function, qr/some_regex/, \&another_function, qr/another_regex/]
This is distinct from the idea of sum types.
1 comments

Oh, I get that their example said _alternating_ function and regex. If that's the real requirement then they shouldn't be _alternating_ in the list at all, there should be a list of (function, regex) tuples. We don't need an example of tuples, they're even more widespread than sum types / unions / enums.

So the design as stated is very contrived, to the point where it doesn't make sense, but existing constructs can be used to make sense of it with a change one way or the other.