[erlang-questions] erlang / laziness

t x <>
Sun Mar 2 12:32:05 CET 2014


  I'm from a clojure background, where many things are lazy by
default, including fundamental constructs, like map.

  (def x (map func lst))
  ;; func is not called on lst yet

  This has been a source of annoying bugs.

  In erlang, can I assume that _nothing_ is lazy?


  [ func(X) || X <- Lst],

  now, the "value" of the list-comprehension expression is not used
anywhere (and in a Lazy language like Clojure would not be evaluated
at all).

  However, in Erlang, it's _always_ executed, as nothing is lazy by default.

  Is this assumption correct?


More information about the erlang-questions mailing list