Skip to content

Instantly share code, notes, and snippets.

@bobfirestone
Created March 22, 2017 20:50
Show Gist options
  • Save bobfirestone/c705939babcd57eea7e4d3e39c460595 to your computer and use it in GitHub Desktop.
Save bobfirestone/c705939babcd57eea7e4d3e39c460595 to your computer and use it in GitHub Desktop.
Palindrome problem for week 2 section 15 of FUNCTIONAL PROGRAMMING IN ERLANG THE UNIVERSITY OF KENT
-module(two_15).
-export([palindrome/1]).
palindrome(String)->
Fs = formattedString(String),
Fs == lists:reverse(Fs).
formattedString(String) ->
% remove all spaces & non-word chars
re:replace(string:to_lower(String), "\\s+|\\W", "", [global,{return,list}]).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment