Skip to content

Instantly share code, notes, and snippets.

@elbrujohalcon
Created May 18, 2016 16:07
Show Gist options
  • Save elbrujohalcon/b903be014ae8013cd9f2d31ce14c406b to your computer and use it in GitHub Desktop.
Save elbrujohalcon/b903be014ae8013cd9f2d31ce14c406b to your computer and use it in GitHub Desktop.
For my post @ Medium
-module(dumb_math).
-export([dup/1, init/1]).
dup(X) ->
case gen_server:start_link(dumb_math, X, []) of
{ok, Pid} -> sys:get_state(Pid);
{error, Reason} -> Reason
end.
init(X) when is_number(X) -> {ok, X * 2};
init(_) -> {stop, notnum}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment