Skip to content

Instantly share code, notes, and snippets.

@kirushik
Created April 18, 2015 12:06
Show Gist options
  • Save kirushik/5e79fcd6e2c965f20fa9 to your computer and use it in GitHub Desktop.
Save kirushik/5e79fcd6e2c965f20fa9 to your computer and use it in GitHub Desktop.
Binary palindromes
defmodule Palindrome do
def is_palindrome(x) do
y = x |> Integer.to_char_list(2)
y == Enum.reverse y
end
end
1900..2100 |> Enum.filter &Palindrome.is_palindrome/1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment