From manny8383@hotmail.com  Mon Aug 28 04:31:04 2000
Received: from hotmail.com (law-f264.hotmail.com [209.185.130.180])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id EAA21003
	for <prolog@swi.psy.uva.nl>; Mon, 28 Aug 2000 04:31:04 +0200 (MET DST)
Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC;
	 Sun, 27 Aug 2000 19:31:04 -0700
Received: from 128.8.96.27 by lw1fd.hotmail.msn.com with HTTP;	Mon, 28 Aug 2000 02:31:04 GMT
X-Originating-IP: [128.8.96.27]
From: "Manny Obrey" <manny8383@hotmail.com>
To: nangelop@csd.abdn.ac.uk
Cc: prolog@swi.psy.uva.nl
Subject: Re: input/output redirect
Date: Mon, 28 Aug 2000 02:31:04 GMT
Mime-Version: 1.0
Content-Type: text/plain; format=flowed
Message-ID: <LAW-F264yfyz5b6KZmc00000437@hotmail.com>
X-OriginalArrivalTime: 28 Aug 2000 02:31:04.0887 (UTC) FILETIME=[03A93C70:01C01098]

these work! thanks!


>From: Nicos Angelopoulos <nangelop@csd.abdn.ac.uk>
>To: Manny Obrey <manny8383@hotmail.com>
>CC: prolog@swi.psy.uva.nl
>Subject: Re: input/output redirect
>Date: Thu, 24 Aug 2000 11:42:09 +0100
>
>
>
>On Wed, 23 Aug 2000, Manny Obrey wrote:
>
> >
> >   hello,
> >
> >       i'd like to do the following
> >
> >       >prolog -c database < inputfile > outputfile
> >
> >       where 'database' is a file w/ clauses,
> >       'inputfile' contains queries, and
> >       'outputfile' contains the output from the queries.
> >       All i end up w/ however is an empty 'outputfile'.
> >
> >       any hlp for a newbie app.
> >       - manny
> >
>
>1. you should change -c to -f, alternatively, use -g consult(database).
>
>eg
>
>% pl -f database < inputfile > outputfile
>
>% pl -g 'consult(database)' < inputfile > outputfile
>
>2. an alternative way would be to change your inputfile to
>something like
>
>:- consult( database ).
>
>main( OutFile ) :-
>	tell( OutFile ),
>	q1( _X ),
>	q2( _Y ),
>	...
>	qn( _Z ),
>	told.
>
>
>% pl -g 'consult(inputfile),main(outputfile),halt'
>
>
>in any case you need to make sure queries in 1. succeed only once
>
>for a more declarative style you mind want to consider
>things like
>
>main( OutFile ) :-
>	findall( X, q1(datum1,X), Xs ),
>	once( q2(datum2,Y) ),
>	tell( OutFile ),
>	write( 'q1(datum1,X) - Xs :' ), write( Xs ), nl,
>	write( 'once(q2(datum1,Y)) - Y :' ), write( Y ), nl,
>	write( 'call(q3(datum3)) :' ), nl,
>	q3(datum3),
>	told.
>
>
>
>nicos.
>

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.

