Skip to content

Instantly share code, notes, and snippets.

@manpages
Created January 20, 2013 21:47
Show Gist options
  • Save manpages/4581995 to your computer and use it in GitHub Desktop.
Save manpages/4581995 to your computer and use it in GitHub Desktop.
Let's talk about Elixir
iex(14)> f = function do
...(14)> (do: anything) -> anything
...(14)> (_) -> :nothing
...(14)> end
#Fun<erl_eval.6.82930912>
iex(15)> f.(do: 42)
42
iex(16)> f.(do
...(16)> answer = 42
...(16)> answer
...(16)> end)
** (SyntaxError) iex:16: syntax error before: do
/home/magbo/.kerl/releases/r15b02/lib/parsetools-2.0.7/include/yeccpre.hrl:128: :elixir_parser.yecctoken_end_location/1
/home/magbo/.kerl/releases/r15b02/lib/parsetools-2.0.7/include/yeccpre.hrl:113: :elixir_parser.yeccpars1/7
/home/magbo/.kerl/releases/r15b02/lib/parsetools-2.0.7/include/yeccpre.hrl:56: :elixir_parser.yeccpars0/5
src/elixir_translator.erl:17: :elixir_translator.forms/4
src/elixir_translator.erl:27: :elixir_translator.forms!/4
src/elixir.erl:96: :elixir.eval/4
/home/magbo/github/others/elixir/lib/iex/lib/iex/server.ex:19: IEx.Server.do_loop/1
iex(16)> f.(:wat)
:nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment