[erlang-questions] erlang / laziness
Sun Mar 2 14:20:36 CET 2014
andalso will evaluate second expression only if first is true
orelse will evaluate second expression only if first is false
Nothing else is lazy from what I know.
On Mar 2, 2014, at 12:32 PM, t x wrote:
> 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?
> erlang-questions mailing list
More information about the erlang-questions