[erlang-questions] erlang / laziness

Sergej Jurecko sergej.jurecko@REDACTED
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.


Sergej

On Mar 2, 2014, at 12:32 PM, t x wrote:

> 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!
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list