Erlang OTP 21.3
erlang.org
erlang.org
As someone who works with an older version of erlang, this is a killer feature. Well done.
For example, I personally hated the way records were done in Erlang, but in Erlang 17 they added Clojure-style maps to fix that. I hated that in order to do a loop in a lambda, you had to implement a y-combinator, but they fixed that.
Heh, I see what you did there.
fun(F)->fun(X)->F(fun(V)->X(X(V))end)end(fun(X)->F(fun(V)->X(X(V))end)end)endBasically, Erlang doesn't allow loops, only recursion, which is fine for regular functions, since you can just use the function's name. However, anonymous functions inherently do not have a name, and as a result the only way to do loops is to whip out your textbook on Lambda Calculus, and copy Haskell Curry's way of doing recursion.
It works fine, but it's also really hard to read, and not fun. Erlang 17 allowed you to give a temporary name to the lambda, which you could use for recursion.
I've edited my original comment to make the pun more apparent.
Also, it's useful for any other particular reason you might need recursion (e.g. directory traversal)
EDIT: In regards to assigning it to a variable, I don't believe that will work, since the naming comes after the fact. I could be wrong on that.