/images/avatar.jpg

Elixir Wizards Talk: "Dealing With a Monster Ecto Query"

Last month, I spoke at the first-ever Elixir Wizards Conference. It was a lightning talk walking through a refactor I did before the 2020 US Presidential Election, titled “Dealing With a Monster Ecto Query.”

I work for a news company, so the presidential election is a huge deal; we can’t have downtime. I knew which query was our bottleneck, so I optimized it right before the election. This took advantage of a few Elixir features, like atoms, the pin operator, and concurrency primitives.

Quakers & Forced Assimilation of Native Americans

Quakers were heavily involved in the forced-assimilation of Native Americans.

Today, through the Friends Committee on National Legislation (the Quaker lobbyist), we advocate for Native rights and Native sovereignty. FCNL employs Portia Kay^nthos Skenandore-Wheelock, a member of the Oneida Nation to run its Native American Congressional Advocacy Program. It was previously run by Kerri Colfer of the Tlingit Nation, and before that Lacina Tangnaqudo Onco of the Shinnecock & Kiowa Nations.

Finding Quakers

Trying to find Quakers near you? Try one of these links:

General

Note that the “worldwide” link also includes a way to register yourself as an “isolated Friend” if there’s no meeting near you. With time, new meetings can form.

LGBTQ+

If you are concerned about LGBTQ+ affirmation, here are lists of meetings that have formally stated their affirming position.

Reading List: Intro to Quakers

Start of a List

Elixir has a lot of ways to get the first thing in a list. One of the first things you learn from the basic syntax guide on the Elixir website is that hd(foo) gets the first thing in a list, and tl(foo) gets the rest. You also learn [ head | tail ] = foo.

But what happens when it’s an empty list?

iex(1)> foo = []
[]
iex(2)> hd(foo)
** (ArgumentError) argument error
    :erlang.hd([])
iex(3)> tl(foo)
** (ArgumentError) argument error
    :erlang.tl([])

Those first bits of syntax you learned will throw errors if given empty lists. That means you need to only use them after confirming the list has stuff in it, such as with a conditional or by pattern-matching.