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

  • swipl
    • library
      • error.pl
      • debug.pl
      • apply.pl -- Apply predicates on a list
      • lists.pl -- List Manipulation
      • broadcast.pl
      • shlib.pl
      • option.pl
      • thread_pool.pl -- Resource bounded thread management
      • gensym.pl
      • settings.pl
      • arithmetic.pl
      • main.pl
      • readutil.pl
      • operators.pl
      • pairs.pl
      • prolog_source.pl -- Examine Prolog source-files
      • record.pl
      • 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
      • quasi_quotations.pl
      • pure_input.pl
      • solution_sequences.pl -- Modify solution sequences
      • ordsets.pl
      • random.pl -- Random numbers
      • base64.pl
      • aggregate.pl
      • csv.pl
      • 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_colour.pl -- Prolog syntax colouring support.
      • lazy_lists.pl
      • ugraphs.pl
      • url.pl
      • www_browser.pl
      • prolog_pack.pl -- A package manager for Prolog
      • git.pl -- Run GIT commands
      • rbtrees.pl
      • dif.pl
      • charsio.pl
      • prolog_stack.pl -- Examine the Prolog stack
      • edinburgh.pl -- Some traditional Edinburgh predicates
      • prolog_clause.pl
      • prolog_breakpoints.pl
      • wfs.pl
      • dialect.pl
      • prolog_code.pl
      • sort.pl
      • iostream.pl -- Utilities to deal with streams
      • dicts.pl
      • varnumbers.pl
      • fastrw.pl
      • prolog_coverage.pl
      • ansi_term.pl -- Print decorated text to ANSI consoles
      • terms.pl -- Term manipulation
      • backcomp.pl -- Backward compatibility
      • thread.pl
      • base32.pl
      • codesio.pl -- I/O on Lists of Character Codes
      • coinduction.pl
      • date.pl
      • heaps.pl
      • statistics.pl
      • utf8.pl
      • when.pl -- Conditional coroutining
      • oset.pl -- Ordered set manipulation
      • zip.pl
      • macros.pl -- Macro expansion
      • listing.pl
      • threadutil.pl -- Interactive thread utilities
      • writef.pl
      • prolog_debug.pl
      • increval.pl
      • tables.pl
      • strings.pl
      • optparse.pl -- command line parsing
      • nb_set.pl
      • system.pl
      • persistency.pl
      • quintus.pl -- Quintus compatibility
      • prolog_autoload.pl
      • check.pl
      • prolog_codewalk.pl -- Prolog code walker
      • edit.pl
      • prolog_versions.pl -- Demand specific (Prolog) versions
      • prolog_metainference.pl -- Infer meta-predicate properties
      • prolog_history.pl
      • prolog_config.pl -- Provide configuration information
      • intercept.pl
      • ctypes.pl
      • make.pl
      • prolog_trace.pl
      • prolog_jiti.pl
      • exceptions.pl
      • portray_text.pl
      • shell.pl -- Elementary shell commands
 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.