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

Zoltan Somogyi zoltan.somogyi at runbox.com
Tue Jan 25 20:58:02 AEDT 2022


2022-01-25 10:11 GMT+11:00 "Sean Charles (emacstheviking)" <objitsu at gmail.com>:
> Is there a more concise way of creating a map full of static data? The best I have obtained is this:
> 
> default_typemap = Out :-
>     map.from_assoc_list([
>         ("i"    - "int"),
>         ("psz"  - "char*"),
>         ("v"    - "void"),
>         ("pv"   - "void*"),
>         ("c"    - "char"),
>         ("sc"   - "signed char"),
>         ("uc"   - "unsigned char"),
>         ("pc"   - "char*"),
>         ("ppc"  - "char**"),
>         ("cpc"  - "const char*"),
>         ("cppc" - "const char**")
>     ],
>     Types),

No, there isn't. Since map is an abstract data type, there is no way
to construct values of that type except by calling predicates of the map module.
The call to map.from_assoc_list is the obvious one to use in this case.

Zoltan.


More information about the users mailing list