5.4.2 Predicates for managing dicts
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • SWI-Prolog extensions
        • Dicts: structures with named arguments
          • Predicates for managing dicts
            • is_dict/1
            • is_dict/2
            • get_dict/3
            • get_dict/5
            • dict_create/3
            • dict_pairs/3
            • put_dict/3
            • put_dict/4
            • del_dict/4
            • :</2
            • select_dict/3
            • >:</2
            • Destructive assignment in dicts
    • Packages
Availability:built-in
put_dict(+New, +DictIn, -DictOut)
DictOut is a new dict created by replacing or adding key-value pairs from New to Dict. New is either a dict or a valid input for dict_create/3. This predicate is normally accessed using the functional notation. Below are some examples:
?- A = point{x:1, y:2}.put(_{x:3}).
A = point{x:3, y:2}.

?- A = point{x:1, y:2}.put([x=3]).
A = point{x:3, y:2}.

?- A = point{x:1, y:2}.put([x=3,z=0]).
A = point{x:3, y:2, z:0}.