3 ms·
I sometimes ponder, how much effort it would take to make a similar matching interface not for binaries but for regexps and/or something grammar-like. After str
by codesnik 4y ago
I sometimes ponder, how much effort it would take to make a similar matching interface not for binaries but for regexps and/or something grammar-like. After structured matching of binaries regexps in elixir just feel awkward.
It wouldn't work well with other matching constructs, though, if matching is baked into beamvm itself as a core instruction for speed or something. Guess I have something to investigate this evening.
- bmitc 4y agoIt's not Elixir, but you might be interested in F#'s active patterns, particularly the parameterized active patterns: https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/active-patterns#parameterized-active-patterns https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref... F#'s active patterns allow you to extend the built-in pattern matching to other things, and in this case, you can have patterns that return regular expression matches.
- codesnik 4y agosounds interesting, thanks.
- pmarreck 4y agoYou could probably write a regex parser in pure Elixir