4.16 Examining the program
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Examining the program
          • current_atom/1
          • current_blob/2
          • current_functor/2
          • current_flag/1
          • current_key/1
          • current_predicate/1
          • current_predicate/2
          • predicate_property/2
          • dwim_predicate/2
          • clause/2
          • clause/3
          • nth_clause/3
          • clause_property/2
    • Packages
Availability:built-in
current_functor(?Name, ?Arity)
True when Name/Arity is a known functor. This means that at some point in time a term with name Name and Arity arguments was created. Functor objects are currently not subject to garbage collection. Due to timing, t/2 below with instantiated Name and Arity can theoretically fail, i.e., a functor may be visible in instantiated mode while it is not yet visible in unbound mode. Considering that the only practical value of current_functor/2 we are aware of is to analyse resource usage we accept this impure behaviour.
t(Name, Arity) :-
    (   current_functor(Name, Arity)
    ->  current_functor(N, A), N == Name, A == Arity
    ;   true
    ).