Query Substitutions

SWI-Prolog offers a query substitution mechanism similar to that of Unix csh (csh(1)), called `history'. It allows the user to compose new queries from those typed before and remembered by the system. It also allows to correct queries and syntax errors. SWI-Prolog does not offer the Unix csh capabilities to include arguments. This is omitted as it is unclear how the first, second, etc. argument should be defined.[*]

The available history commands are shown in table [*]. Figure [*] gives some examples.


Table: History commands
!!. Repeat last query
!nr. Repeat query numbered <nr>
!str. Repeat last query starting with <str>
!?str. Repeat last query holding <str>
^old^new. Substitute <old> into <new> of last query
!nr^old^new. Substitute in query numbered <nr>
!str^old^new. Substitute in query starting with <str>
!?str^old^new. Substitute in query holding <str>
h. Show history list
!h. Show this list


Figure: Some examples of the history facility
\begin{figure}\begin{boxed}
\begin{code}
/u4/staff/jan/.plrc consulted, 0.066667...
...101, 114, 115, 101]
\par
Yes
6 ?- halt.
\end{code}\end{boxed}\par\end{figure}



Subsections