Home Contents Index Summary Previous Next

4.44 Miscellaneous

dwim_match(+Atom1, +Atom2)
Succeeds if Atom1 matches Atom2 in `Do What I Mean' sense. Both Atom1 and Atom2 may also be integers or floats. The two atoms match if:

dwim_match(+Atom1, +Atom2, -Difference)
Equivalent to dwim_match/2, but unifies Difference with an atom identifying the the difference between Atom1 and Atom2. The return values are (in the same order as above): equal, mismatched_char, inserted_char, transposed_char, separated and transposed_word.

wildcard_match(+Pattern, +String)
Succeeds if String matches the wildcard pattern Pattern. Pattern is very similar the the Unix csh pattern matcher. The patterns are given below:

? Matches one arbitrary character.
* Matches any number of arbitrary characters.
[ ... ] Matches one of the characters specified between the brackets.
<char1>-<char2> indicates a range.
{...} Matches any of the patterns of the comma separated list between the braces.

Example:


?- wildcard_match('[a-z]*.{pro,pl}[%~]', 'a_hello.pl%').

Yes

gensym(+Base, -Unique)
Generate a unique atom from base Base and unify it with Unique. Base should be an atom. The first call will return <base>1 , the next <base>2 , etc. Note that this is no warrant that the atom is unique in the system. (52)

sleep(+Time)
Suspend execution Time seconds. Time is either a floating point number or an integer. Granularity is dependent on the system's timer granularity. A negative time causes the timer to return immediately. On most non-realtime operating systems we can only ensure execution is suspended for at least Time seconds.

On Unix systems the sleep/1 predicate is realised ---in order of preference--- by nanosleep(), usleep(), select() if the time is below 1 minute or sleep(). On Windows systems Sleep() is used.