• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

5.4.2 Predicates for managing dicts
All Application Manual Name SummaryHelp

  • 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
            • dict_same_keys/2
            • put_dict/3
            • put_dict/4
            • del_dict/4
            • :</2
            • select_dict/3
            • >:</2
            • Destructive assignment in dicts
    • Packages
Availability:built-in
[semidet]+Select :< +From
True when Select is a‘sub dict’of From: the tags must unify and all keys in Select must appear with unifying values in From. From may contain keys that are not in Select. This operation is frequently used to match a dict and at the same time extract relevant values from it. For example:
plot(Dict, On) :-
        _{x:X, y:Y, z:Z} :< Dict, !,
        plot_xyz(X, Y, Z, On).
plot(Dict, On) :-
        _{x:X, y:Y} :< Dict, !,
        plot_xy(X, Y, On).

The goal Select :< From is equivalent to select_dict(Select, From, _).

ClioPatria (version V3.1.1-51-ga0b30a5)