• 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.25 library(lists): List Manipulation
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(lists): List Manipulation
          • member/2
          • append/3
          • append/2
          • prefix/2
          • select/3
          • selectchk/3
          • select/4
          • selectchk/4
          • nextto/3
          • delete/3
          • nth0/3
          • nth1/3
          • nth0/4
          • nth1/4
          • last/2
          • proper_length/2
          • same_length/2
          • reverse/2
          • permutation/2
          • flatten/2
          • clumped/2
          • subseq/3
          • max_member/2
          • min_member/2
          • max_member/3
          • min_member/3
          • sum_list/2
          • max_list/2
          • min_list/2
          • numlist/3
          • is_set/1
          • list_to_set/2
          • intersection/3
          • union/3
          • subset/2
          • subtract/3
    • Packages
Availability::- use_module(library(lists)).(can be autoloaded)
Source[det]list_to_set(+List, ?Set)
True when Set has the same elements as List in the same order. The left-most copy of duplicate elements is retained. List may contain variables. Elements E1 and E2 are considered duplicates iff E1 == E2 holds. The complexity of the implementation is N*log(N).
Errors
List is type-checked.
See also
sort/2 can be used to create an ordered set. Many set operations on ordered sets are order N rather than order N**2. The list_to_set/2 predicate is more expensive than sort/2 because it involves, two sorts and a linear scan.
Compatibility
Up to version 6.3.11, list_to_set/2 had complexity N**2 and equality was tested using =/2.
ClioPatria (version V3.1.1-51-ga0b30a5)