[erlang-questions] erlang / laziness

t x txrev319@REDACTED
Sun Mar 2 12:32:05 CET 2014


Hi,

  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?

  i.e.

  some-expression,
  [ func(X) || X <- Lst],
  some-other-expression

  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?

Thanks!



More information about the erlang-questions mailing list