Skip to content

Instantly share code, notes, and snippets.

@athos
Created December 11, 2015 05:03
Show Gist options
  • Save athos/c5a7f2e0fa45ab392977 to your computer and use it in GitHub Desktop.
Save athos/c5a7f2e0fa45ab392977 to your computer and use it in GitHub Desktop.
> defmodule M do
> def f do
> x = 0
> {fn -> x = 1 end, fn -> x end}
> end
> end
iex:4: warning: variable x is unused
{:module, M,
<<70, 79, 82, 49, 0, 0, 5, 24, 66, 69, 65, 77, 69, 120, 68, 99, 0, 0, 0, 124, 131, 104, 2, 100, 0, 14, 101, 108, 105, 120, 105, 114, 95, 100, 111, 99, 115, 95, 118, 49, 108, 0, 0, 0, 4, 104, 2, ...>>,
{:f, 0}}
> {g, h} = M.f
{#Function<0.66867849/0 in M.f/0>, #Function<1.66867849/0 in M.f/0>}
> h.()
0
> g.()
1
> h.()
0
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment