Foo = fun(N) -> put(var, N), fun(X) -> V = get(var) + X, put(var, V), V end end.
It's not as concise as Ruby or Arc, but it's a one liner. However, similar to Haskell, this style of programming is discouraged in Erlang.
Foo = fun(N) -> put(var, N), fun(X) -> V = get(var) + X, put(var, V), V end end.
It's not as concise as Ruby or Arc, but it's a one liner. However, similar to Haskell, this style of programming is discouraged in Erlang.