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

  • swipl
    • library
      • error.pl
      • debug.pl
      • apply.pl
      • lists.pl
      • broadcast.pl
      • shlib.pl
      • option.pl
      • thread_pool.pl
      • gensym.pl -- Generate unique symbols
      • settings.pl
      • arithmetic.pl -- Extensible arithmetic
      • main.pl
      • readutil.pl -- Read utilities
      • operators.pl
      • pairs.pl
      • prolog_source.pl
      • record.pl -- Access compound arguments by name
      • predicate_options.pl
      • sandbox.pl -- Sandboxed Prolog code
      • apply_macros.pl -- Goal expansion rules to avoid meta-calling
      • yall.pl
      • assoc.pl
      • prolog_format.pl -- Analyse format specifications
      • quasi_quotations.pl
      • pure_input.pl
      • solution_sequences.pl
      • ordsets.pl
      • random.pl
      • 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
      • ugraphs.pl -- Graph manipulation library
      • url.pl
      • www_browser.pl
      • prolog_pack.pl
      • git.pl -- Run GIT commands
      • rbtrees.pl
      • dif.pl
      • charsio.pl -- I/O on Lists of Character Codes
      • 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 -- Utilities for numbered terms
      • tables.pl -- XSB interface to tables
      • base32.pl
      • codesio.pl
      • coinduction.pl
      • date.pl
      • heaps.pl
      • statistics.pl -- Get information about resource usage
      • terms.pl -- Term manipulation
      • utf8.pl
      • when.pl -- Conditional coroutining
      • backcomp.pl -- Backward compatibility
      • prolog_qlfmake.pl -- Compile the library to QLF format
      • ansi_term.pl
      • persistency.pl
      • nb_set.pl -- Non-backtrackable sets
      • listing.pl
      • intercept.pl
      • make.pl
      • check.pl -- Consistency checking
      • prolog_coverage.pl
      • zip.pl
      • threadutil.pl -- Interactive thread utilities
      • prolog_trace.pl
      • portray_text.pl
      • prolog_debug.pl -- User level debugging tools
      • increval.pl
      • edit.pl -- Editor interface
      • strings.pl
      • prolog_versions.pl
      • hashtable.pl
      • prolog_codewalk.pl -- Prolog code walker
      • optparse.pl -- command line parsing
      • prolog_jiti.pl
      • prolog_config.pl -- Provide configuration information
      • prolog_profile.pl
      • thread.pl
      • files.pl
      • prolog_metainference.pl
      • writef.pl
      • system.pl -- System utilities
      • shell.pl -- Elementary shell commands
      • macros.pl
      • rwlocks.pl
      • prolog_autoload.pl -- Autoload all dependencies
      • ctypes.pl -- Character code classification
      • oset.pl
      • quintus.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.