| 1 |
%%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 |
%%^^A This is a sample file to demonstrate the use of the \LaTeX style option |
| 3 |
%%^^A pl.sty. |
| 4 |
%%^^A |
| 5 |
%%^^A The ^^A is just used to make it printable with the documentation. |
| 6 |
%%^^A doc.sty insists on it. Otherwise a single % would have been enough. |
| 7 |
%%^^A |
| 8 |
%%^^A written by gene 11/94 |
| 9 |
%%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 10 |
|
| 11 |
:- module(sample). /* |
| 12 |
|
| 13 |
This is a dummy module to show the possibilities of the \LaTeX{} style |
| 14 |
option pl. |
| 15 |
We define a predicate. It looks like |
| 16 |
|
| 17 |
\Predicate select/3(Member, List, Rest). |
| 18 |
|
| 19 |
This predicate describes the relation of the three arguments which fulfill |
| 20 |
$\mbox{\it Member}\in\mbox{\it List}$\/ and $\mbox{\it Rest}=\mbox{\it |
| 21 |
List}\backslash\mbox{\it Member}$. |
| 22 |
|
| 23 |
And here comes the implementation: |
| 24 |
\PL*/ |
| 25 |
select(Member,[Member|Rest],Rest). |
| 26 |
select(Member,[Head|List],[Head|Rest]) :- |
| 27 |
select(Member,List,Rest). |
| 28 |
/*PL |
| 29 |
|
| 30 |
\Predicate in/2(Member, List). |
| 31 |
|
| 32 |
This predicate is a reimplementation of the predicate \verb|member/2| |
| 33 |
using the \verb|select/3| predicate. |
| 34 |
|
| 35 |
\PL*/ |
| 36 |
in(Member,List) :- |
| 37 |
select(Member,List,_). |
| 38 |
/*PL |
| 39 |
Now we are done with the example. |
| 40 |
\EndProlog*/ |