Skip to content

Instantly share code, notes, and snippets.

@diogovk
Last active August 29, 2015 14:11
Show Gist options
  • Save diogovk/148894bf73f33c328acc to your computer and use it in GitHub Desktop.
Save diogovk/148894bf73f33c328acc to your computer and use it in GitHub Desktop.
defmodule Stuff do
def inlist([search_item|_tail], search_item), do: true
def inlist([_head|tail], search_item) , do: inlist(tail, search_item)
def inlist([], _), do: false
end
IO.inspect(Stuff.inlist([1,2,3],1))
IO.inspect(Stuff.inlist([4,2,3],1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment