no function clause matching became no case clause matching exception

Dieter Schön dieter@REDACTED
Fri Dec 10 16:26:33 CET 2021


Hi Frans,


I tested all my installed versions, from 19. onwards, with this neat 
feature of asdf:

for v in $(asdf list erlang); do

   asdf shell erlang $v

   echo $v

   erlc lico.erl

   erl -s lico -s init stop

done

It crashes all the time.

I think the reason for the crash is that atoms b and c do not 
pattern-match with the atom a in the fun definition.


So probably you had different data in your previous, successful tests?

A question from me: is there a way to define a lambda with different 
function clauses?

In general, I would think, it is not advisable. When the lambda gets 
complicated, I use a statically defined function..


Kind regards,

Dieter


On 10.12.21 15:51, Frans Schneider wrote:
> Dear list,
>
> The following list comprehension used to give a no function clause 
> matching exception in previous version of Erlang. Now it will emit a 
> no case clause matching exception. Is this expected behavior?
>
>     [(fun(a) -> "a" end)(R) || R <- [a, b, c]]
>
> NB: I use this construct to process lists with different record types. 
> In the unit tests I was testing explicitly on this type of exception.
>
> Frans
>
>


More information about the erlang-questions mailing list