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

  • swipl
    • library
      • error.pl
      • debug.pl -- Print debug messages and test assertions
      • apply.pl
      • lists.pl -- List Manipulation
      • broadcast.pl
      • shlib.pl -- Utility library for loading foreign objects (DLLs, shared objects)
      • option.pl
      • thread_pool.pl -- Resource bounded thread management
      • gensym.pl
      • settings.pl -- Setting management
      • arithmetic.pl -- Extensible arithmetic
      • main.pl -- Provide entry point for scripts
      • readutil.pl -- Read utilities
      • operators.pl
      • pairs.pl
      • prolog_source.pl -- Examine Prolog source-files
      • record.pl -- Access compound arguments by name
      • predicate_options.pl -- Access and analyse predicate options
      • sandbox.pl
      • apply_macros.pl -- Goal expansion rules to avoid meta-calling
      • yall.pl -- Lambda expressions
      • assoc.pl -- Binary associations
      • prolog_format.pl
      • quasi_quotations.pl -- Define Quasi Quotation syntax
      • pure_input.pl -- Pure Input from files and streams
      • solution_sequences.pl -- Modify solution sequences
      • ordsets.pl -- Ordered set manipulation
      • random.pl
      • base64.pl -- Base64 encoding and decoding
      • aggregate.pl -- Aggregation operators on backtrackable predicates
      • csv.pl -- Process CSV (Comma-Separated Values) data
      • pprint.pl
      • atom.pl
      • modules.pl -- Module utility predicates
      • occurs.pl -- Finding and counting sub-terms
        • contains_term/2
        • contains_var/2
        • free_of_term/2
        • free_of_var/2
        • occurrences_of_term/3
        • occurrences_of_var/3
        • sub_term/2
        • sub_var/2
        • sub_term_shared_variables/3
      • prolog_xref.pl -- Prolog cross-referencer data collection
      • prolog_colour.pl -- Prolog syntax colouring support.
      • lazy_lists.pl -- Lazy list handling
      • ugraphs.pl -- Graph manipulation library
      • url.pl
      • www_browser.pl -- Open a URL in the users browser
      • prolog_pack.pl -- A package manager for Prolog
      • git.pl -- Run GIT commands
      • rbtrees.pl -- Red black trees
      • dif.pl -- The dif/2 constraint
      • charsio.pl
      • prolog_stack.pl
      • edinburgh.pl
      • prolog_clause.pl
      • prolog_breakpoints.pl
      • wfs.pl -- Well Founded Semantics interface
      • dialect.pl
      • prolog_code.pl
      • sort.pl
      • iostream.pl -- Utilities to deal with streams
      • dicts.pl
      • varnumbers.pl
      • base32.pl
      • codesio.pl
      • coinduction.pl
      • date.pl -- Process dates and times
      • heaps.pl -- heaps/priority queues
      • statistics.pl
      • terms.pl -- Term manipulation
      • utf8.pl -- UTF-8 encoding/decoding on lists of character codes.
      • when.pl
      • backcomp.pl -- Backward compatibility
      • threadutil.pl -- Interactive thread utilities
      • strings.pl
      • ctypes.pl -- Character code classification
      • prolog_debug.pl -- User level debugging tools
      • quintus.pl
      • shell.pl -- Elementary shell commands
      • ansi_term.pl
      • prolog_versions.pl -- Demand specific (Prolog) versions
      • hashtable.pl -- Hash tables
      • prolog_profile.pl -- Execution profiler
      • prolog_qlfmake.pl -- Compile the library to QLF format
      • optparse.pl
      • zip.pl -- Access resource ZIP archives
      • listing.pl -- List programs and pretty print clauses
      • tables.pl -- XSB interface to tables
      • persistency.pl -- Provide persistent dynamic predicates
      • prolog_trace.pl
      • prolog_wrap.pl -- Wrapping predicates
      • thread.pl -- High level thread primitives
      • streams.pl
      • check.pl -- Consistency checking
      • intercept.pl
      • prolog_codewalk.pl
      • prolog_metainference.pl
      • exceptions.pl -- Exception classification
      • increval.pl
      • prolog_config.pl -- Provide configuration information
      • files.pl
      • prolog_coverage.pl
      • oset.pl -- Ordered set manipulation
      • macros.pl -- Macro expansion
      • make.pl -- Reload modified source files
      • system.pl
      • portray_text.pl -- Portray text
      • prolog_jiti.pl -- Just In Time Indexing (JITI) utilities
      • nb_set.pl
      • rwlocks.pl -- Read/write locks
      • fastrw.pl -- Fast reading and writing of terms
      • qsave.pl
      • edit.pl -- Editor interface
      • explain.pl
      • prolog_autoload.pl -- Autoload all dependencies
      • writef.pl -- Old-style formatted write
      • prolog_history.pl -- Per-directory persistent commandline history
 sub_term_shared_variables(+Sub, +Term, -Vars) is det
If Sub is a sub term of Term, Vars is bound to the list of variables in Sub that also appear outside Sub in Term. Note that if Sub appears twice in Term, its variables are all considered shared.

An example use-case is refactoring a large clause body by introducing intermediate predicates. This predicate can be used to find the arguments that must be passed to the new predicate.