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

  • swipl
    • library
      • error.pl
      • debug.pl
      • apply.pl -- Apply predicates on a list
      • lists.pl
      • broadcast.pl
      • shlib.pl
      • option.pl -- Option list processing
      • thread_pool.pl
      • gensym.pl
      • settings.pl -- Setting management
      • arithmetic.pl
      • main.pl
      • readutil.pl
      • operators.pl
      • pairs.pl
      • prolog_source.pl
      • record.pl
      • quasi_quotations.pl -- Define Quasi Quotation syntax
      • pure_input.pl -- Pure Input from files and streams
      • 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
      • yall.pl -- Lambda expressions
      • sandbox.pl
      • apply_macros.pl -- Goal expansion rules to avoid meta-calling
      • assoc.pl
      • prolog_format.pl
      • predicate_options.pl -- Access and analyse predicate options
      • csv.pl
      • pprint.pl
      • atom.pl -- Operations on atoms
      • modules.pl
      • occurs.pl
      • prolog_xref.pl
      • prolog_colour.pl
      • lazy_lists.pl -- Lazy list handling
      • ugraphs.pl -- Graph manipulation library
      • url.pl
      • www_browser.pl
      • prolog_pack.pl
      • git.pl
      • utf8.pl -- UTF-8 encoding/decoding on lists of character codes.
      • dialect.pl
      • system.pl -- System utilities
      • terms.pl
      • date.pl
      • persistency.pl -- Provide persistent dynamic predicates
      • iostream.pl -- Utilities to deal with streams
      • prolog_stack.pl
      • edinburgh.pl
      • prolog_clause.pl
      • prolog_breakpoints.pl -- Manage Prolog break-points
      • wfs.pl
      • prolog_code.pl -- Utilities for reasoning about code
      • sort.pl
      • dicts.pl -- Dict utilities
      • dif.pl -- The dif/2 constraint
      • varnumbers.pl
      • pio.pl
      • base32.pl
      • charsio.pl
      • codesio.pl
      • coinduction.pl
      • heaps.pl -- heaps/priority queues
      • rbtrees.pl
      • statistics.pl
      • when.pl
      • backcomp.pl
      • ctypes.pl -- Character code classification
      • prolog_profile.pl
      • optparse.pl
      • strings.pl -- String utilities
      • threadutil.pl -- Interactive thread utilities
      • help.pl -- Text based manual
      • listing.pl
      • ansi_term.pl -- Print decorated text to ANSI consoles
      • shell.pl
      • edit.pl
      • explain.pl
      • prolog_debug.pl
      • prolog_coverage.pl
      • make.pl
      • streams.pl
      • check.pl
      • macros.pl
      • quintus.pl
      • exceptions.pl -- Exception classification
      • fastrw.pl
      • increval.pl
      • tables.pl
      • nb_set.pl
      • prolog_codewalk.pl
      • prolog_metainference.pl
      • zip.pl
      • thread.pl -- High level thread primitives
      • portray_text.pl
      • prolog_autoload.pl
      • prolog_versions.pl
      • tty.pl
      • readln.pl
      • prolog_wrap.pl
      • writef.pl
 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).