Pattern Matching a Function Body: Binaries June 22, 2019 You cannot view this unit as you're not logged in yet. Go to Account to login. 10 Comments Joep Stender on July 10, 2020 at 2:14 pm The link to https://hexdocs.pm/elixir/Kernel.SpecialForms.html in this article is displayed incorrectly. Log in to Reply Mark Ericksen on July 10, 2020 at 2:31 pm Thanks Joep! There is a problem linking directly to the function. I can’t do it or it corrupts the rendering. 🙁 The function I’m referring to is <<>>/1 I’ve fixed the rendering problem but at the cost of a less precise link. Log in to Reply romenigld on December 14, 2020 at 12:20 pm Wow this help me a lot, I always don’t understand well when I see something about binary using elixir. Now this opens my mind. Thank you so much, your explanations are awesome! i will now read on Documentation about this <> and be prepared. Log in to Reply Mark Ericksen on December 14, 2020 at 1:35 pm Awesome! I’m glad it is helpful! Log in to Reply Mark Johnson on February 23, 2021 at 12:47 am These lessons are proving to be very helpful for me. I was surprised to find that the rest of the binary data does not match unless ::binary is appended. def image_type(<>), do: :png doesn’t work but def image_type(<>), do: :png does work Thank you, Mark, for making this available. Log in to Reply Vitaly Vasiliev on June 5, 2021 at 9:31 pm 1.13 elixir, little problem with 1 test, it is not accepting “SAY “, only “SAY” etc Log in to Reply Mark Ericksen on June 6, 2021 at 6:34 am Hello Vitaly! Can you be more specific? I just tested using Elixir 1.12.1 (current latest released version) and all the tests pass without a need to change. Log in to Reply Vitaly Vasiliev on June 5, 2021 at 9:31 pm Fixed by removing space in the test. 🙂 Log in to Reply Jaison Vieira on October 4, 2021 at 8:31 pm My tests passed doing this: def image_type(@png_signature _image_body), do: :png def image_type(@jpg_signature _image_body), do: :jpg I see your solution is different. Is it the best way to do or just different? Why do both of them work? Log in to Reply Maksym Kosenko on December 13, 2021 at 3:03 pm The links from “Recap” were very helpful for me! Thanks a lot, Mark Log in to Reply Leave a Comment Cancel ReplyYou must be logged in to post a comment.