Skip to content

Instantly share code, notes, and snippets.

@the-undefined
Created May 27, 2017 15:36
Show Gist options
  • Save the-undefined/272288400682d77704eaa484f45b4292 to your computer and use it in GitHub Desktop.
Save the-undefined/272288400682d77704eaa484f45b4292 to your computer and use it in GitHub Desktop.
Ejixir - reimplementing the Elixir `tl` and `hd` functions
defmodule Ejixir do
def j_tl(coll) do
[ _h | t ] = coll
t
end
def j_hd(coll) do
[ h | _t ] = coll
h
end
end
IO.inspect Ejixir.j_tl(["a", "b", "c"])
IO.inspect Ejixir.j_hd(["a", "b", "c"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment