Did you know ... Search Documentation:
dwim.pl
PublicShow source
Source $dwim_correct_goal(:Goal, +Bindings, -Corrected)
Correct a goal (normally typed by the user) in the `Do What I Mean' sense. Ask the user to confirm if a unique correction can be found.
Errors
- existence_error(procedure, PI) if the goal cannot be corrected.
Source no_context(+PI) is semidet[private]
True if we should omit the DWIM message because messages.pl gives an additional explanation.
Source correct_meta_arguments(:Goal, +Module, +Bindings, -Final) is det[private]
Correct possible meta-arguments. This performs a recursive check on meta-arguments specified as `0' using :- meta_predicate/1. As a special exception, the arment of call/1 is not checked, so you can use call(X) as an escape from the DWIM system.
Source correct_literal(:Goal, +Bindings, +DWIMs, -Corrected) is semidet[private]
Correct a single literal. DWIMs is a list of heads that can replace the head in Goal.
Source $find_predicate(:Spec, -PIs:list(pi)) is det
Unify `List' with a list of predicate indicators that match the specification `Spec'. `Spec' is a term Name/Arity, a ``Head'', or just an atom. The latter refers to all predicate of that name with arbitrary arity. `Do What I Mean' correction is done. If the requested module is `user' predicates residing in any module will be considered matching.
Errors
- existence_error(procedure, Spec) if no matching predicate can be found.
 pack(+PIs, +Module, +Arity, +Context, -Packs)[private]
Pack the list of heads into packets, consisting of the corrected specification and a list of heads satisfying this specification.
Source name_arity(+Spec, -Name, -Arity)[private]
Obtain the name and arity of a predicate specification. Warn if this is not a legal specification.
Source principal_predicates(:Heads, +Context, -Principals)[private]
Get the principal predicate list from a list of heads (e.g., the module in which the predicate is defined).
Source strip_subsumed_heads(+Heads, -GenericOnes)[private]
Given a list of Heads, remove subsumed heads, while maintaining the order. The implementation is slow, but only used on small sets and only for toplevel related tasks.
Source dwim_predicate(:Head, -NewHead) is nondet
Find a head that is in a `Do What I Mean' sence the same as `Head'. backtracking produces more such predicates. If searches for:
  • predicates with a similar name in an import module
  • predicates in a similar module with the same name
  • predicates in any module with the same name
Source dwim_pred(:Head, -DWIM) is nondet[private]
True if DWIM is a predicate with a similar name than Head in the module of Head or an import module thereof.
Source $similar_module(:Goal, -DWIMGoal) is nondet
True if DWIMGoal exists and is, except from a typo in the module specification, equivalent to Goal.