dwango / fialyzer

[WIP] Faster Implementation of Dialyzer
https://dwango.github.io/fialyzer/
Apache License 2.0
56 stars 8 forks source link

Support list comprehension #92

Open yoshihiro503 opened 5 years ago

yoshihiro503 commented 5 years ago

list comprehension [E_0 || Q_1, ..., Q_k]

amutake commented 5 years ago

In Erlang to Core Erlang conversion, for example [ N * 2 || N <- [1,2,3] ] is converted to:

letrec lc = fun _1 -> 
  case _1 of
    [N | _2] -> [N * 2 | lc(_2)];
    [] -> [];
    _ -> error(function_clause)
  end
in
lc([1,2,3])

(to see, erlc +to_core list_comprehension.erl && cat list_comprehension.core)