Did you know ... Search Documentation:
Pack bousi_pack -- prolog/source/utilities.pl
PublicShow source
 process_term(+Term, -Result, +Scanners, +Testers, +InData, -OutData)
Generic higher-order predicate that can be used to scan and/or process a Term with some InData in order to get a Result term and some OutData. This predicate uses two different lists of predicates (which can be empty):
  • Scanners: predicates with signature "(+Term, -Result, +InData, -OutData)" that must not fail.
  • Testers: unary predicates with signature "(+Term)" that may optionally fail.

The behavior of the process_term/6 predicate is defined by means of the following algorithm:

  • 1: Call the Scanners with the initial Term and InData to get a Result and some OutData.
  • 2: If Result is not a compound term, return Result and OutData.
  • 3: If Result is a compound term:
    • 3.1: Call the Testers with the Result.
    • 3.2: If any of the Testers fail, return Result and OutData.
    • 3.3: If all the Testers succeed:
      • 3.3.1: Call this predicate recursively with each of the arguments of Result. OutData will be passed as InData on the first call to get a new OutData, then this OutData will be passed as InData on the second call and so on.
      • 3.3.2: Return a new term with the Result functor and the arguments returned by the recursive calls, and also the OutData returned by the last recursive call.
 get_predicates(-PredicateList) is det
Unifies PredicateList with the list of the names of all the predefined predicates in SWI-Prolog.
 get_predicates_modules(+ModuleList, -PredicateList)
Unifies PredicateList with the list of the names of the predicates that are available in each of the modules of the ModuleList.
 simplify_filename(+Path, -SimplifiedFilename)
Extracts the filename part of Path, applies the simplify_atom/2 to it and unifies the resulting filename with SimplifiedFilename.
See also
- simplify_atom/2
 simplify_atom(+Atom, -SimplifiedAtom)
Replaces all the non-alphanumeric characters of Atom with underscores, modifies its first character if it's not a lowercase letter and returns the resulting atom in SimplifiedAtom.
 write_lines(+List, +Prefix, +Sufix)
Writes a list of terms in current output stream. Prefix and Sufix strings will be added before and after every term, respectively.
 extract_terms(+Prefix, +Arity, +List, -Items)
Extracts all the compound terms from List that match template "Prefix/Arity" and returns them in the Items list.

For example, given Prefix = 'sim' and Arity = 3, this predicate will only return "sim(_, _, _)" terms.

Compatibility
- iso
 ascending_numbers(+List) is det
Succeeds only if all the items of List are integer numbers and they're in ascending order too.
Compatibility
- iso
 remove_prefixes(+List, -Result, +Prefix)
Extracts all the atoms of List that begin with Prefix sub-atom, removes Prefix from all those atoms and returns them in Result.

For example, given List = ['atom1', 'other', 'atom_ex'] and Prefix = 'atom', this predicate will return Result = ['1', '_ex'].

Compatibility
- iso
 remove_program_prefix(+Atom, -Result)
Removes the current program prefix from Atom and returns in Result. If Atom does not include the program prefix, just returns Atom.
 remove_quotes(+String, ?FixedString)
Removes the initial and final quote characters of String and returns the result in FixedString. If String is a list, this predicate will copy all their items to FixedString, removing the initial and final quote characters of every quoted string.
 is_quoted(+String, ?QuoteChar)
Succeeds if String starts and ends with QuoteChar character.
 home_directory(?HomeDir)
Unifies HomeDir with the path to the user's home directory, which is taken from $HOME environment variable on Unix/Linux or from %HOMEDRIVE% and %HOMEPATH% environment variables on Windows.
 file_is_newer(+File1, +File2)
Succeeds only if File1 is newer than File2, i.e., File1 has been modified after File2.
 builtin(+Predicate) is semidet
Succeeds only if Predicate is the head of a SWI-Prolog predefined predicate or a predicate declared in any of the currently loaded modules.
 atom_is_variable(+Atom) is semidet
Succeeds if Atom is an atomic term which starts with an uppercase letter or an underscore character (_).
 closure_properties(+Properties, ?Closure, ?TNorm)
Scans a list with the closure Properties of a fuzzy relation and returns its Closure and TNorm numeric values, which can then be used to invoke the ext_closure/5 foreign predicate.

Valid fuzzy relation properties are 'symmetric', 'reflexive' and 'transitive(TNorm)', where TNorm can be 'yes', 'no', 'min', 'product' or 'luka'.

 relation_name(?Symbol, ?Name)
Succeeds if Name is the internal name of the relation defined by Symbol in BPL files.
 relation_evaluator(?Relation, ?Evaluator)
Succeeds if Evaluator is the name of the predicate that is used internally to compare two terms using a certain Relation.