A.53 library(terms): Term manipulation
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(terms): Term manipulation
          • term_size/2
          • variant/2
          • subsumes_chk/2
          • subsumes/2
          • term_subsumer/3
          • term_factorized/3
          • mapargs/3
          • mapsubterms/3
          • mapsubterms_var/3
          • foldsubterms/4
          • foldsubterms/5
          • same_functor/2
          • same_functor/3
          • same_functor/4
    • Packages
Availability::- use_module(library(terms)).(can be autoloaded)
Source[semidet]foldsubterms(:Goal3, +Term1, +State0, -State)
[semidet]foldsubterms(:Goal4, +Term1, ?Term2, +State0, -State)
The predicate foldsubterms/5 calls call(Goal4, SubTerm1, SubTerm2, StateIn, StateOut) for each subterm, including variables, in Term1. If this call fails, StateIn and StateOut are the same. This predicate may be used to map subterms in a term while collecting state about the mapped subterms. The foldsubterms/4 variant does not map the term.