• 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

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
            • empty_assoc/1
            • list_to_assoc/2
            • ord_list_to_assoc/2
          • Querying association lists
          • Modifying association lists
          • Conversion predicates
          • Reasoning about association lists and their elements
    • Packages

A.4.2 Creating association lists

An association list is created with one of the following predicates:

[semidet]empty_assoc(?Assoc)
Is true if Assoc is the empty association list.
[det]list_to_assoc(+Pairs, -Assoc)
Create an association from a list Pairs of Key-Value pairs. List must not contain duplicate keys.
Errors
domain_error(unique_key_pairs, List) if List contains duplicate keys
[det]ord_list_to_assoc(+Pairs, -Assoc)
Assoc is created from an ordered list Pairs of Key-Value pairs. The pairs must occur in strictly ascending order of their keys.
Errors
domain_error(key_ordered_pairs, List) if pairs are not ordered.

ClioPatria (version V3.1.1-51-ga0b30a5)