Skip to content

Instantly share code, notes, and snippets.

@kevsmith
Created October 30, 2009 19:55
Show Gist options
  • Select an option

  • Save kevsmith/222656 to your computer and use it in GitHub Desktop.

Select an option

Save kevsmith/222656 to your computer and use it in GitHub Desktop.
Unexpected Erlang behavior
-module(dog).
-export([new/1, woof/1]).
new(Name) -> {dog, Name}.
woof(Self) ->
{dog, Name} = Self,
io:format("~p says 'woof!'~n", [Name]).
Eshell V5.7.2 (abort with ^G)
1> c("/Users/ksmith/dog", [{outdir, "/Users/ksmith/"}]).
{ok,dog}
2> Dog = dog:new("Rover").
{dog,"Rover"}
3> Dog:woof().
"Rover" says 'woof!'
ok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment