2 ms·
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 deliverer
by ch4s3 4y ago
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. I rewrote an hl7 parser from Java to Ruby to Elixr some years ago and the elixir implementation performed as well as Java and was more readable by miles.
- bongobingo1 4y ago> 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 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.
- deleted 4y ago[deleted]
- noloblo 4y agoIs this parser available for educational purposes on github thanks
- noloblo 4y agoWhat are atoms