Skip to content

Instantly share code, notes, and snippets.

@sleepiecappy
Created May 18, 2019 18:38
Show Gist options
  • Save sleepiecappy/7647abc2af3f698055ed92dda792910f to your computer and use it in GitHub Desktop.
Save sleepiecappy/7647abc2af3f698055ed92dda792910f to your computer and use it in GitHub Desktop.
check if two elements are consecutive
defmodule Consecutive do
defp consecutive([]) do
false
end
defp consecutive([a | [a | _rest]]) do
true
end
defp consecutive([_a | rest]) do
consecutive(rest)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment