1. 11

    Not a language, but a language feature: in Elixir, there’s a capture operator & that will wrap functions in an anonymous function and also can be used to refer to the nth argument of a function. For example:

    add_one = fn x -> x + 1 end
    

    is replaced by

    add_one = &(&1 + 1)
    

    This helps avoid naming arguments unnecessarily.

    Read more

    1. 10

      This is one of the features inspired by Clojure. In Clojure, #(foo %) is short for (fn [x] (foo x))

      1. 2

        You also have %1, %2 etc. in Clojure.

      2. 4

        There’s also the pipe operator |> which passes the result of the expression on the left side as the first argument of the function on the right.

        https://elixirschool.com/en/lessons/basics/pipe-operator/

        1. 1

          Scala also has _, which in _ + 1 is an alias for x => x + 1, or in the case of f(_), is an alias for x => f(x). Oleg Kiselyov has an interesting take on it.

          1. 1

            I’m not that familiar with Elixir (only having done a few basic distributed algorithms in it), but this feature has piqued my interest even further in the language, thanks for the handy tip!