A.4 library(assoc): Association lists
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(assoc): Association lists
          • Introduction
          • Creating association lists
          • Querying association lists
          • Modifying association lists
          • Conversion predicates
          • Reasoning about association lists and their elements
            • is_assoc/1
            • map_assoc/2
            • map_assoc/3
    • Packages

A.4.6 Reasoning about association lists and their elements

Further inspection predicates of an association list and its elements are:

[semidet]is_assoc(+Assoc)
True if Assoc is an association list. This predicate checks that the structure is valid, elements are in order, and tree is balanced to the extent guaranteed by AVL trees. I.e., branches of each subtree differ in depth by at most 1. Does not validate that keys are sufficiently instantiated to ensure the tree remains valid if a key is further instantiated.
[semidet]map_assoc(:Pred, +Assoc)
True if Pred(Value) is true for all values in Assoc.
[semidet]map_assoc(:Pred, +Assoc0, ?Assoc)
Map corresponding values. True if Assoc is Assoc0 with Pred applied to all corresponding pairs of of values.