Matching Complex Data Types

You cannot view this unit as you're not logged in yet. Go to Account to login.

7 Comments

  1. xrsia on May 8, 2020 at 4:32 am

    Excellent !!!

  2. Francisco Quintero on November 13, 2020 at 12:49 pm

    Awesome. I’m understanding more pattern matching.

  3. Maksym Kosenko on October 16, 2021 at 11:26 am

    Outstanding! 🎹 🎷 🎻 🎯

  4. Takudzwa Gwindingwi on October 26, 2021 at 11:08 am

    This is really helpful thanks.

  5. Juan Borrás on August 24, 2023 at 6:58 am

    When executing the following in `iex`:

    “`{iex}
    f = fn a -> case a do
    %{_a, _b, _c} -> “A tuple of size 3, so what?”
    _ -> “Uhh…. what’s that?”
    end
    end
    “`

    I get the following error: `** (CompileError) iex:24: expected key-value pairs in a map, got: _a`
    Am I running a too old Elixir-Erland/OTP combo? Elixir v1.12..2 on Erlang 24 erts 12.2.1

    • Mark Ericksen on August 24, 2023 at 7:12 am

      I think the issue is you put a “%” on the front, making the datastructure a Map, but it’s and invalid structure for a map. Remove the “%” for it to be a tuple.

      • Juan Borrás on August 24, 2023 at 8:20 am

        *insert-huge-facepalm-image-here*
        You were right on target. Working like a charm now.
        Thanks for the course and for your time.

Leave a Comment

You must be logged in to post a comment.