Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The Erlang version is unnecessarily verbose (and also semantically different) because it uses 2 processes. It can be rewritten as

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.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: