no function clause matching became no case clause matching exception

Frans Schneider fchschneider@REDACTED
Fri Dec 10 16:30:23 CET 2021

The construct is used to process a list which should contain a mixture 
of #o{} and #oa{} records. If the list contains other types of records 
--which should never be the case--, it must fail. This is the actual code:

This is the actual code

     ATE_ids = [(fun(#oa{id = AT_id}) -> AT_id;
                    (#o{id = AT_id}) -> AT_id end)(AT) || AT <- ATEs],

It enables me to process different records/maps or whatever is in the 
list and will fail when something is in the list that shouldn't be there.

Op 10-12-2021 om 16:16 schreef Eckard Brauer:
> Just a bit curious, what is the lambda fun intended to do?
> fun(a) -> "a" end
> looks to me as it would only evaluate if called with a single symbol a
> as arg and (silently) fail otherwise. If I extend a littl I get:
> 10> [(fun F(a) -> "a"; F(_) -> nothing end)(R) || R <- [a, b, c]].
> ["a",nothing,nothing]
> Don't mind if the question is stupid, I'm still learning...
> E.
>> 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