You can also match on equality by re-using the same param name in the function definition:
defmodule Example do
def any?(, _a), do: false
def any?([a | _tail], a), do: true
def any?([_head | tail], a), do: any?(tail, a)
I really dig the pattern for head being equal to the element you are looking for.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.