Can clp(fd) programs be run under Ciao. I have read through the
documentation and see that it supports clp(r) and clp(q) but no mention of
fd. I have a simple program as follows I am trying to run.
/*
A kid goes into a grocery store and buys four items. The cashier charges $7.11.
The kid pays and is about to leave when the cashier calls the kid back, and says
"Hold on, I multiplied the four items instead of adding them; I'll try again...
Gosh, with adding them the price still comes to $7.11"! What were the prices of
the four items?
*/
go :-
cputime(X),
Vars=[A,B,C,D],
Vars in 1..711,
A+B+C+D #= 711,
T1 #= (A * B) // 100,
T2 #= (C * D) // 100,
T1 * T2 #= 711 * 100,
labeling(Vars),
cputime(Y),
T is Y-X,
write(Vars), write(' found in '), write(T), write(' milliseconds'),nl.
Thanks,
Rob Dreyfoos
-----------------------------
President
Photo Electronics Corporation
17280 Woodinville-Redmond Road NE, Suite 805
Woodinville, WA 98072-9088
Voice: 425-806-9500 Fax: 425-806-0503
Email: rwdreyfoos(a)att.net
-----------------------------
Thank you Francisco,
I hope you dont mind me writing back to all the users.
I have been working on the perl side for now, and have implemented a
POSTGRES
database table system for storing all the facts. It turns out that a DB is
very comfortable to use.
Now prolog will be very interesting to use for the analysis and queries,
because many of
the queries to validate programs and analyse semantics are logical in
nature.
Do you think that such a cacheing system is interesting even if there is a
database?
I mean, caching is also a way implement swapping, but if you have a datbase,
who will be implementing the caching?
How hard will it be to create a DB access to an existing database, what are
your experiences?
Mike
-----Original Message-----
From: Francisco Bueno Carrillo [mailto:bueno(a)clip.dia.fi.upm.es]
Sent: Donnerstag, 31. Januar 2002 15:56
To: michael.dupont(a)mciworldcom.de
Subject: Re: Database and memory limitations
Michael,
I don't know if you have return to Prolog in your project of program
meta information of c++ programs. When I first saw your message about
memory limitations I implemented a small library that automatically
allows to cache Prolog facts in files, so that only a limited amount
of them reside in Prolog's memory at one time. I am sending you the
code attached, in case you find it useful.
It is made up of three files: cache.pl cache_tr.pl cache_rt.pl
You have to put them in a subdirectory "cache" of the library
directory of your Ciao installation. Then you can use it as a package,
so that you write in your program module:
:- use_package(cache).
and this enables the use of directives of the form:
:- cache(node/3,node_info_file,1000).
to specify that predicate node/3 is defined in file node_info_file by
Prolog facts, of which there should be only up to 1000 in Prolog's
memory at any given time.
Note that it only works if the predicate is defined only by
facts. Note also that the upper bound on the number of "active" facts
is related to each goal to the predicate, so you have to do some
estimation: the bound x the number of goals active (i.e., which still
have a possibility to be backtracked into) at any given time during
execution should be lower than the total number of facts of the
predicate. Otherwise, you will end up having more facts in memory than
those that define the predicate itself, with the effect of overloading
Prolog's memory instead of alleviating it!!
Please, also note that I have not thoroughly tested this package, so
it is kind of in beta mode. Anyway, I hope you find it useful!
Francisco Bueno
CLIP group - CS Dept. - FIM - UPM
Campus de Montegancedo - 28660, Boadilla del Monte - Madrid
Tel: +34 1 336 7441 Fax: +34 1 352 4819 Internet: bueno(a)fi.upm.es
http://www.clip.dia.fi.upm.es/~bueno/
Dear Dayana,
You probably want to use fetch_url/3 in Ciao. Have a look at the
chapters documenting Pillow in the Ciao manual.
Regards,
Francisco Bueno
CLIP group - CS Dept. - FIM - UPM
Campus de Montegancedo - 28660, Boadilla del Monte - Madrid
Tel: +34 1 336 7441 Fax: +34 1 352 4819 Internet: bueno(a)fi.upm.es
http://www.clip.dia.fi.upm.es/~bueno/
Hello
I am new user of CIAO/PROLOG, I need to know which is the equivalent
of the predicate load_html_file/2 that is used with the version of
SWI-Prolog. As I use this predicate in CIAO.
I thank to you, its help, is urgent!!!! I am student of a Master, I
need it to make a task.. I need a predicate in CIAO to read a
file.html and it transforms it into a list... (If you can send me an
example)
Thank you
I wait a prompt answer
Sincerely
DAYANA
pd:Im sorry, I SPEAK little English
----------- Mensaje Original --------------
De: Dupont, Michael [michael.dupont(a)mciworldcom.de]
Para: Francisco Bueno Carrillo [bueno(a)clip.dia.fi.upm.es],
ciao-users(a)clip.dia.fi.upm.es [ciao-users(a)clip.dia.fi.upm.es]
Cc:
Asunto: RE: Database and memory limitations
Fecha: 31/01/2002 16:35:45
Mensaje:
Thank you Francisco,
I hope you dont mind me writing back to all the users.
I have been working on the perl side for now, and have implemented a
POSTGRES
database table system for storing all the facts. It turns out that a DB is
very comfortable to use.
Now prolog will be very interesting to use for the analysis and queries,
because many of
the queries to validate programs and analyse semantics are logical in
nature.
Do you think that such a cacheing system is interesting even if there is a
database?
I mean, caching is also a way implement swapping, but if you have a datbase,
who will be implementing the caching?
How hard will it be to create a DB access to an existing database, what are
your experiences?
Mike
-----Original Message-----
From: Francisco Bueno Carrillo [mailto:bueno(a)clip.dia.fi.upm.es]
Sent: Donnerstag, 31. Januar 2002 15:56
To: michael.dupont(a)mciworldcom.de
Subject: Re: Database and memory limitations
Michael,
I don't know if you have return to Prolog in your project of program
meta information of c++ programs. When I first saw your message about
memory limitations I implemented a small library that automatically
allows to cache Prolog facts in files, so that only a limited amount
of them reside in Prolog's memory at one time. I am sending you the
code attached, in case you find it useful.
It is made up of three files: cache.pl cache_tr.pl cache_rt.pl
You have to put them in a subdirectory "cache" of the library
directory of your Ciao installation. Then you can use it as a package,
so that you write in your program module:
:- use_package(cache).
and this enables the use of directives of the form:
:- cache(node/3,node_info_file,1000).
to specify that predicate node/3 is defined in file node_info_file by
Prolog facts, of which there should be only up to 1000 in Prolog's
memory at any given time.
Note that it only works if the predicate is defined only by
facts. Note also that the upper bound on the number of "active" facts
is related to each goal to the predicate, so you have to do some
estimation: the bound x the number of goals active (i.e., which still
have a possibility to be backtracked into) at any given time during
execution should be lower than the total number of facts of the
predicate. Otherwise, you will end up having more facts in memory than
those that define the predicate itself, with the effect of overloading
Prolog's memory instead of alleviating it!!
Please, also note that I have not thoroughly tested this package, so
it is kind of in beta mode. Anyway, I hope you find it useful!
Francisco Bueno
CLIP group - CS Dept. - FIM - UPM
Campus de Montegancedo - 28660, Boadilla del Monte - Madrid
Tel: +34 1 336 7441 Fax: +34 1 352 4819 Internet: bueno(a)fi.upm.es
http://www.clip.dia.fi.upm.es/~bueno/