4.8 Meta-Call Predicates
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Meta-Call Predicates
          • call/1
          • call/2
          • apply/2
          • not/1
          • once/1
          • ignore/1
          • call_with_depth_limit/3
          • call_with_inference_limit/3
          • setup_call_cleanup/3
          • setup_call_catcher_cleanup/4
          • call_cleanup/2
          • call_cleanup/3
          • undo/1
    • Packages
Availability:built-in
Source[ISO]call(:Goal)
Call Goal. This predicate is normally used for goals that are not known at compile time. For example, the Prolog toplevel essentially performs read(Goal), call(Goal). Also a meta predicates such as ignore/1 are defined using call:
ignore(Goal) :- call(Goal), !.
ignore(_).

Note that a plain variable as a body term acts as call/1 and the above is equivalent to the code below. SWI-Prolog produces the same code for these two progams and listing/1 prints the program above.

ignore(Goal) :- Goal, !.
ignore(_).

Note that call/1 restricts the scope of the cut (!/0). A cut inside Goal only affects choice points created by Goal.