Question: Being new to Elixir I'm having some problems understanding pattern matching.

If I have an Elixir data structure like this:

```
list_with_maps = [%{"id" => 1, "name" => "a"}, %{"id" => 2, "name" => "b"}]

```

What would be the best way to get values of all id fields from it?

Answer: 
You can map over the list and return the id using [Enum.map/2](http://elixir-lang.org/docs/v1.1/elixir/Enum.html#map/2)

```
Enum.map(list_with_maps, fn (x) -> x["id"] end)
[1, 2]

```

You can write the same function using the [capture](http://elixir-lang.org/docs/v1.1/elixir/Kernel.SpecialForms.html#&/1) operator:

```
Enum.map(list_with_maps, & &1["id"])

```

I prefer writing `& &1["id"]` as `&(&1["id"])` but the parentheses are optional.
Another option is to use the `get_in` function and leveraging the `Access` module. The Access module lets you build expressive ways of dealing with nested data structures.

To get a list of values at `"id"` you could run:

```
get_in(list_with_maps, [Access.all, "id"])  

```

Passing `Access.all` as the first element in the list, followed by `"id"` tells `get_in` to return all `list_with_maps`'s `"id"` value.

It may seem like overkill for this example, but if your structure looked like:

```
list_with_maps = [%{"id" => 1, "identities" => [%{"name" => "a"}, %{"name" => "Secret A"}]}, %{"id" => 2, "identities" => [%{"name" => "b"},%{"name" => "Secret B"}]}]

```

We could get all of the names with:

```
get_in(list_with_maps, [Access.all, "identities", Access.all, "name"])
# [["a", "Secret A"], ["b", "Secret B"]]

```