News for hackers. Stuff that matters.
Re:Elixir for Humans Who Know Python by bongobingo1 on Saturday February 25, 2023 @01:32PM (#34939155)
> You can pattern match on basically any shape, not just atoms. Imagine you’re parsing a protocol over tcp and want to grab groups of characters between deliverers, you can pattern match that.

Ex: https://youtu.be/MaQqa21uxQ8?t=548 (note that "binary" here is a "binary blob of bytes").

Andreas pattern matches on the magic byte, then encoded string length, then the string (using the previous matched length), then an int, all in the function header, no if-else-try-catch mess.

There are no comments on this comment yet.