/usr/local/lib/swipl/library/solution_sequences.pl
All Application Manual Name SummaryHelp

  • swipl
    • library
      • error.pl
      • debug.pl -- Print debug messages and test assertions
      • apply.pl -- Apply predicates on a list
      • lists.pl -- List Manipulation
      • broadcast.pl -- Event service
      • shlib.pl
      • option.pl -- Option list processing
      • thread_pool.pl
      • gensym.pl -- Generate unique symbols
      • settings.pl
      • arithmetic.pl
      • main.pl -- Provide entry point for scripts
      • readutil.pl
      • operators.pl -- Manage operators
      • pairs.pl -- Operations on key-value lists
      • prolog_source.pl -- Examine Prolog source-files
      • record.pl -- Access compound arguments by name
      • quasi_quotations.pl
      • pure_input.pl
      • solution_sequences.pl -- Modify solution sequences
        • distinct/1
        • distinct/2
        • reduced/1
        • reduced/3
        • limit/2
        • offset/2
        • call_nth/2
        • order_by/2
        • group_by/4
      • ordsets.pl
      • random.pl
      • base64.pl
      • aggregate.pl -- Aggregation operators on backtrackable predicates
      • yall.pl -- Lambda expressions
      • sandbox.pl -- Sandboxed Prolog code
      • apply_macros.pl -- Goal expansion rules to avoid meta-calling
      • assoc.pl -- Binary associations
      • prolog_format.pl
      • predicate_options.pl -- Access and analyse predicate options
      • csv.pl -- Process CSV (Comma-Separated Values) data
      • pprint.pl -- Pretty Print Prolog terms
      • atom.pl -- Operations on atoms
      • modules.pl -- Module utility predicates
      • occurs.pl
      • prolog_xref.pl -- Prolog cross-referencer data collection
      • prolog_colour.pl -- Prolog syntax colouring support.
      • lazy_lists.pl
      • ugraphs.pl -- Graph manipulation library
      • url.pl -- Analysing and constructing URL
      • www_browser.pl -- Open a URL in the users browser
      • prolog_pack.pl -- A package manager for Prolog
      • git.pl -- Run GIT commands
      • utf8.pl
      • dialect.pl -- Support multiple Prolog dialects
      • system.pl
      • terms.pl -- Term manipulation
      • date.pl -- Process dates and times
      • persistency.pl
      • iostream.pl -- Utilities to deal with streams
      • prolog_stack.pl -- Examine the Prolog stack
      • edinburgh.pl -- Some traditional Edinburgh predicates
      • prolog_clause.pl
      • prolog_breakpoints.pl -- Manage Prolog break-points
      • wfs.pl -- Well Founded Semantics interface
      • prolog_code.pl -- Utilities for reasoning about code
      • sort.pl
      • dicts.pl -- Dict utilities
      • dif.pl
      • varnumbers.pl -- Utilities for numbered terms
      • pio.pl
      • base32.pl
      • charsio.pl
      • codesio.pl -- I/O on Lists of Character Codes
      • coinduction.pl
      • heaps.pl -- heaps/priority queues
      • rbtrees.pl
      • statistics.pl -- Get information about resource usage
      • when.pl
      • backcomp.pl -- Backward compatibility
      • threadutil.pl -- Interactive thread utilities
      • prolog_debug.pl
      • thread.pl -- High level thread primitives
      • prolog_profile.pl -- Execution profiler
      • intercept.pl -- Intercept and signal interface
      • quintus.pl -- Quintus compatibility
      • tables.pl -- XSB interface to tables
      • make.pl
      • check.pl -- Consistency checking
      • oset.pl -- Ordered set manipulation
      • rwlocks.pl
      • edit.pl
      • prolog_wrap.pl
      • prolog_history.pl -- Per-directory persistent commandline history
      • prolog_config.pl
      • optparse.pl -- command line parsing
      • ansi_term.pl -- Print decorated text to ANSI consoles
      • portray_text.pl
      • increval.pl
      • prolog_versions.pl -- Demand specific (Prolog) versions
      • prolog_codewalk.pl
      • listing.pl -- List programs and pretty print clauses
      • prolog_metainference.pl -- Infer meta-predicate properties
      • prolog_jiti.pl
      • strings.pl
      • shell.pl -- Elementary shell commands
      • macros.pl -- Macro expansion
      • ctypes.pl -- Character code classification
      • nb_set.pl -- Non-backtrackable sets
      • streams.pl -- Manage Prolog streams
      • prolog_autoload.pl
      • hashtable.pl -- Hash tables
      • tty.pl
      • explain.pl
      • prolog_coverage.pl
      • zip.pl -- Access resource ZIP archives
      • files.pl
      • writef.pl -- Old-style formatted write
 distinct(:Goal)
 distinct(?Witness, :Goal)
True if Goal is true and no previous solution of Goal bound Witness to the same value. As previous answers need to be copied, equivalence testing is based on term variance (=@=/2). The variant distinct/1 is equivalent to distinct(Goal,Goal).

If the answers are ground terms, the predicate behaves as the code below, but answers are returned as soon as they become available rather than first computing the complete answer set.

distinct(Goal) :-
    findall(Goal, Goal, List),
    list_to_set(List, Set),
    member(Goal, Set).