Let us take our input data from a file called ``in''.
We wrap the test/0 predicate into a predicate go/0 which takes input from the specified file ``in''. This file should contain legal Prolog terms ---for the predicate double/2 we want something like:
Now to redirect output to a file named ``out'':
go:-Using the same file ``in'' as previously, ``out'' will contain: