[m-users.] Initialising a map with static data

Zoltan Somogyi zoltan.somogyi at runbox.com
Tue Jan 25 20:55:34 AEDT 2022


2022-01-25 11:27 GMT+11:00 "Fabrice Nicol" <fabrnicol at gmail.com>:
> Below is an alternative, which has pros and cons.

In this case, I don't think there are any significant pros.
With a list of pairs, the type enforces the invariant that
every key has exactly one value, while a pair of lists
does not, as you yourself acknowledge.

>     det_insert_from_corresponding_lists(K1, V1, map.init, Types),

This could be written more simply as

assoc_list.from_corresponding_lists(K1, V1, Types)

Zoltan.


More information about the users mailing list