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

  • swipl
    • library
      • error.pl
      • debug.pl
      • apply.pl
      • lists.pl
      • broadcast.pl -- Event service
      • shlib.pl
      • option.pl
      • thread_pool.pl -- Resource bounded thread management
      • gensym.pl
      • settings.pl
      • arithmetic.pl
      • main.pl
      • readutil.pl -- Read utilities
      • operators.pl
      • pairs.pl
      • prolog_source.pl
      • record.pl
      • predicate_options.pl -- Access and analyse predicate options
      • sandbox.pl -- Sandboxed Prolog code
      • apply_macros.pl -- Goal expansion rules to avoid meta-calling
      • yall.pl
      • assoc.pl
      • prolog_format.pl
      • quasi_quotations.pl
      • pure_input.pl -- Pure Input from files and streams
      • solution_sequences.pl -- Modify solution sequences
      • ordsets.pl -- Ordered set manipulation
      • random.pl -- Random numbers
      • base64.pl
      • aggregate.pl
      • csv.pl
      • pprint.pl
      • atom.pl
      • modules.pl
      • 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
      • dif.pl -- The dif/2 constraint
      • charsio.pl
      • prolog_stack.pl -- Examine the Prolog stack
      • edinburgh.pl
      • prolog_clause.pl
      • prolog_breakpoints.pl -- Manage Prolog break-points
      • wfs.pl
      • dialect.pl
      • prolog_code.pl
      • sort.pl
      • iostream.pl -- Utilities to deal with streams
      • dicts.pl
      • varnumbers.pl
      • thread.pl
      • prolog_jiti.pl -- Just In Time Indexing (JITI) utilities
      • base32.pl
      • codesio.pl
      • coinduction.pl -- Co-Logic Programming
      • date.pl
      • heaps.pl
      • statistics.pl
      • terms.pl
      • utf8.pl
      • when.pl
      • backcomp.pl
      • threadutil.pl -- Interactive thread utilities
      • check.pl -- Consistency checking
      • listing.pl -- List programs and pretty print clauses
      • quintus.pl
      • portray_text.pl
      • rwlocks.pl
      • prolog_debug.pl -- User level debugging tools
      • tables.pl
      • nb_set.pl -- Non-backtrackable sets
      • make.pl
      • macros.pl
      • strings.pl
      • persistency.pl
      • optparse.pl -- command line parsing
      • prolog_codewalk.pl -- Prolog code walker
      • writef.pl
      • prolog_autoload.pl
      • oset.pl
      • prolog_profile.pl
      • ansi_term.pl
      • increval.pl -- Incremental dynamic predicate modification
      • prolog_config.pl
      • prolog_trace.pl
      • ctypes.pl
      • zip.pl -- Access resource ZIP archives
      • hashtable.pl
      • prolog_versions.pl
      • shell.pl -- Elementary shell commands
      • prolog_metainference.pl
      • system.pl -- System utilities
      • fastrw.pl -- Fast reading and writing of terms
      • prolog_history.pl -- Per-directory persistent commandline history
      • exceptions.pl
      • prolog_wrap.pl -- Wrapping predicates
      • prolog_coverage.pl
      • streams.pl -- Manage Prolog streams
      • edit.pl
      • explain.pl
      • files.pl
      • intercept.pl
      • prolog_qlfmake.pl -- Compile the library to QLF format
 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.