• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

/usr/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 -- Extensible arithmetic
      • main.pl -- Provide entry point for scripts
      • readutil.pl
      • operators.pl
      • pairs.pl
      • prolog_source.pl
      • quasi_quotations.pl
      • url.pl
      • www_browser.pl
      • prolog_colour.pl
      • record.pl -- Access compound arguments by name
      • prolog_xref.pl -- Prolog cross-referencer data collection
      • 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
      • ordsets.pl -- Ordered set manipulation
      • assoc.pl
      • ugraphs.pl
      • solution_sequences.pl -- Modify solution sequences
      • atom.pl
      • prolog_pack.pl
      • git.pl -- Run GIT commands
      • ctypes.pl -- Character code classification
      • utf8.pl
      • base64.pl -- Base64 encoding and decoding
      • persistency.pl -- Provide persistent dynamic predicates
      • pure_input.pl
      • nb_set.pl
      • aggregate.pl
      • csv.pl -- Process CSV (Comma-Separated Values) data
      • iostream.pl -- Utilities to deal with streams
      • dialect.pl
      • apply_macros.pl -- Goal expansion rules to avoid meta-calling
      • yall.pl
      • prolog_code.pl -- Utilities for reasoning about code
      • dif.pl -- The dif/2 constraint
      • thread.pl -- High level thread primitives
      • predicate_options.pl
      • rbtrees.pl
      • nb_rbtrees.pl
      • sandbox.pl
      • prolog_format.pl
      • random.pl
      • pprint.pl
      • modules.pl
      • lazy_lists.pl
      • edinburgh.pl
      • prolog_clause.pl
      • prolog_breakpoints.pl
      • dicts.pl
      • backcomp.pl
      • ansi_term.pl
      • threadutil.pl -- Interactive thread utilities
      • base32.pl
      • prolog_debug.pl
      • make.pl
      • check.pl -- Consistency checking
      • charsio.pl -- I/O on Lists of Character Codes
      • listing.pl -- List programs and pretty print clauses
      • prolog_stack.pl -- Examine the Prolog stack
      • statistics.pl -- Get information about resource usage
      • quintus.pl
      • tableutil.pl
      • optparse.pl
      • date.pl
      • terms.pl
      • increval.pl
      • tables.pl
      • prolog_jiti.pl
      • prolog_versions.pl
      • sort.pl
      • codesio.pl
      • intercept.pl
      • prolog_coverage.pl
      • tty.pl
      • prolog_codewalk.pl -- Prolog code walker
      • edit.pl
      • varnumbers.pl -- Utilities for numbered terms
      • explain.pl -- Describe Prolog Terms
      • portray_text.pl -- Portray text
      • prolog_trace.pl
      • prolog_wrap.pl
      • files.pl
      • wfs.pl
      • coinduction.pl
      • strings.pl
      • heaps.pl
      • prolog_qlfmake.pl -- Compile the library to QLF format
      • hashtable.pl
      • help.pl
      • oset.pl
      • prolog_profile.pl
      • shell.pl -- Elementary shell commands
      • prolog_config.pl -- Provide configuration information
      • macros.pl
      • writef.pl
      • prolog_autoload.pl
      • qsave.pl
      • zip.pl
      • system.pl
      • streams.pl -- Manage Prolog streams
      • exceptions.pl
      • prolog_metainference.pl
      • fastrw.pl -- Fast reading and writing of terms
      • when.pl
 occurrences_of_term(@SubTerm, @Term, ?Count) is det
Count the number of SubTerms in Term that unify with SubTerm. As this predicate is implemented using backtracking, SubTerm and Term are not further instantiated. Possible constraints are enforced. For example, we can count the integers in Term using
?- freeze(S, integer(S)), occurrences_of_term(S, f(1,2,a), C).
C = 2,
freeze(S, integer(S)).
See also
- occurrences_of_var/3 for an equality (==/2) based variant.
ClioPatria (version V3.1.1-59-g7b9a7a3)