/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
      • option.pl -- Option list processing
      • thread_pool.pl
      • gensym.pl -- Generate unique symbols
      • settings.pl
      • arithmetic.pl
      • main.pl
      • readutil.pl
      • operators.pl
      • pairs.pl
      • prolog_source.pl
      • 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
      • prolog_format.pl -- Analyse format specifications
      • quasi_quotations.pl
      • pure_input.pl -- Pure Input from files and streams
      • solution_sequences.pl
      • ordsets.pl
      • random.pl
      • base64.pl
      • aggregate.pl -- Aggregation operators on backtrackable predicates
      • csv.pl -- Process CSV (Comma-Separated Values) data
      • pprint.pl -- Pretty Print Prolog terms
      • 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_colour.pl
      • lazy_lists.pl -- Lazy list handling
      • ugraphs.pl
      • url.pl -- Analysing and constructing URL
      • www_browser.pl
      • prolog_pack.pl
      • git.pl
      • 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
      • dialect.pl
      • prolog_code.pl -- Utilities for reasoning about code
      • sort.pl
      • iostream.pl -- Utilities to deal with streams
      • dicts.pl
      • varnumbers.pl -- Utilities for numbered terms
      • date.pl -- Process dates and times
      • backcomp.pl -- Backward compatibility
      • base32.pl -- Base32 encoding and decoding
      • codesio.pl -- I/O on Lists of Character Codes
      • coinduction.pl
      • heaps.pl
      • statistics.pl -- Get information about resource usage
      • terms.pl
      • utf8.pl -- UTF-8 encoding/decoding on lists of character codes.
      • when.pl -- Conditional coroutining
      • ansi_term.pl
      • hashtable.pl -- Hash tables
      • tables.pl -- XSB interface to tables
      • listing.pl
      • edit.pl
      • make.pl -- Reload modified source files
      • quintus.pl
      • thread.pl -- High level thread primitives
      • prolog_debug.pl
      • prolog_profile.pl -- Execution profiler
      • exceptions.pl -- Exception classification
      • optparse.pl
      • nb_set.pl
      • threadutil.pl -- Interactive thread utilities
      • portray_text.pl
      • check.pl -- Consistency checking
      • prolog_trace.pl -- Print access to predicates
      • intercept.pl -- Intercept and signal interface
      • explain.pl
      • zip.pl
      • prolog_jiti.pl
      • persistency.pl
      • prolog_versions.pl -- Demand specific (Prolog) versions
      • prolog_codewalk.pl
      • prolog_metainference.pl
      • oset.pl -- Ordered set manipulation
      • prolog_history.pl
      • prolog_config.pl
      • ctypes.pl -- Character code classification
      • increval.pl
      • prolog_coverage.pl
      • prolog_wrap.pl
      • system.pl -- System utilities
      • macros.pl
      • shell.pl
      • streams.pl -- Manage Prolog streams
      • strings.pl
      • rwlocks.pl
      • writef.pl
      • prolog_autoload.pl
      • qsave.pl -- Save current program as a state or executable
      • fastrw.pl
      • files.pl
 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.