On 07/09/15 15:36, Oleh wrote:
> Dear all
>
>
> I think, DICT is a very nice addition in version 7, but what is the
> reason behind it is not got to SWI-Prolog.h? And thus no PL_ wrappers...
There is no real reason except that I don't really know what is the best
interface.
> In other words, I'd like to create/modify dictionaries in C code, what
> is the best way to do it?
So, at this moment all you can do is use pair-lists in C and do the
translation to/from dicts in Prolog. Note that you cannot *modify*
dicts (except for (further) instantiating values).
An obvious API is probably
PL_get_dict(key, dict, value).
The rest is less clear. Use a closure to enumerate the key/values?
Create one from an aray of {key,value} pairs?
Cheers --- Jan