Skip to content

Instantly share code, notes, and snippets.

@marcincembrzynski
Created August 16, 2017 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcincembrzynski/fd00fe3eb75c8ea7997afd58c53e02da to your computer and use it in GitHub Desktop.
Save marcincembrzynski/fd00fe3eb75c8ea7997afd58c53e02da to your computer and use it in GitHub Desktop.
-module(ex1).
-export([server/1,pal_check/1,pal_check_answer/1]).
server(Pid) ->
receive
{check, String} ->
io:format("got: " ++ String),
Pid ! { result, pal_check_answer(String)},
server(Pid);
_ ->
io:format("stopped")
end.
pal_check_answer(String) ->
A = pal_check(String),
case A of
true -> String ++ " is palindrome";
false -> String ++ " is not palindrome"
end.
pal_check(String) -> String == lists:reverse(String).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment