-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have
parent(mum,[ isa,jm]).
in test_01.pl
after consulting it, I hit:
parent(mum,X).
and get as expected :
X = [isa, jm]
How should I write the file so that asking the same question I get the
answers :
X = isa ;
X = jm ;
I still want to use lists in the file.
I am using SWI-Prolog (Multi-threaded, Version 5.2.13)
on Linux.
###
How can I add knowledge in the DB using the CLI ?
for example if the user consult the file, but want to add knowledge;
- - how should he add information usable later in the same cession ?
- - how to save the whole database into a new file for later use ?
###
Is it possible in PROLOG to execute external file ? something like the C
call 'system' or such ...
###
Thanks
- --
DEMAINE Beno�t-Pierre http:/www.demaine.info/
\_o< apt-get remove ispell >o_/
There're 10 types of people: those who can count in binary and those who
can't
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFBfxIrGWSTLbOSw8IRAiasAKC0mdVvnXrzA/Au+0pm18lMZhezwwCeJ7X/
cFTpn0fXwpKftVwW778j0ds=
=pNoY
-----END PGP SIGNATURE-----
|
|
0
|
|
|
|
Reply
|
nntp_pipex (70)
|
10/27/2004 3:12:44 AM |
|
In article <s7KdnYW2WsA2j-LcRVnyhA@pipex.net>, DEMAINE Benoit-Pierre wrote:
> I have
>
> parent(mum,[ isa,jm]).
>
> in test_01.pl
> after consulting it, I hit:
> parent(mum,X).
> and get as expected :
>
> X = [isa, jm]
>
> How should I write the file so that asking the same question I get the
> answers :
>
> X = isa ;
> X = jm ;
>
> I still want to use lists in the file.
There are two ways. Runtime you get
my_parent(X, Y) :-
parent(X, List),
member(Y, List).
You can also do it compiletime, so you can write the input the way
you like and have it available to Prolog the way Prolog likes it.
term_expansion(parent(X, List), Clauses) :-
mk_parent_clauses(List, X, Clauses).
mk_parent_clauses([], _, []).
mk_parent_clauses([H|T0], X, [parent(X, H)|T]) :-
mk_parent_clauses(T0, X, T).
check the manual for term_expansion/2.
> I am using SWI-Prolog (Multi-threaded, Version 5.2.13)
> on Linux.
>
> ###
>
> How can I add knowledge in the DB using the CLI ?
> for example if the user consult the file, but want to add knowledge;
> - - how should he add information usable later in the same cession ?
> - - how to save the whole database into a new file for later use ?
See dynamic/1, assert/1 for modifying. You can just write the file
yourself, or use listing/1 and/or portray_clause/1.
> ###
>
> Is it possible in PROLOG to execute external file ? something like the C
> call 'system' or such ...
See shell/1. You should have been able to find that in the manualm where
there is a section 'Operating system interaction'.
--- Jan
|
|
0
|
|
|
|
Reply
|
Jan
|
10/27/2004 7:43:08 AM
|
|
|
1 Replies
21 Views
(page loaded in 0.059 seconds)
Similiar Articles: Automatically populating a List of Values - Help - comp.databases ...Hi all This is a quite newbie question. I only wish to fit a list of values, initially empty, with autoincremented numbers, whose values would... GL_ARRAY_BUFFER_ARB vs. GL_ARRAY_BUFFER - comp.graphics.api.opengl ...Hello, Excuse this newbie question please -- I'm reading "Opengl Distilled" which uses GL_ARRAY_BUFFER when binding the VBO, but many examples I read... Counting comma seperated fields - comp.lang.awkHi, Another newbie question: I have files with comma seperated fields and I'd like to count how many fields there are on each line. All I know so far... Newbie : Loading Textures using Cg - comp.graphics.api.opengl ...DXT1 versus PNG` - comp.graphics.api.opengl ... (RGBA, BGRA ... Hi all, I just started to learn OpenGL - and I have a newbie question about ... Qt - comp.graphics.api.openglYou probably want to post to the Qt mailing list - look at http://lists ... Newbie Question: QT Opengl example is not working! - comp.graphics ... Hi there, I hope ... glGetString problem - comp.graphics.api.openglNewbie Question: QT Opengl example is not working! - comp.graphics ..... to complie and run a simple example come with QT called Box, there's no problem ... Newbie's first FPGA board ! - comp.arch.fpgaOn 2007-07-13, PFC <lists@peufeu.com> wrote: > So, the question is, would experienced people be willing ... Newbie's first FPGA board ! - comp.arch.fpga Hello, I have used a ... How to start with gdcm - comp.protocols.dicomHi, I am a complete newbie to gdcm. I want to use ... Post Question | Groups ... > See FAQ: [Where are the GDCM mailing lists ? ] http ... glDrawPixels and Display lists - comp.graphics.api.opengl ...... Post Question | Groups ... glDrawPixels and Display lists - comp.graphics.api ... Newbie : Loading Textures using Cg - comp.graphics.api ... bvh files - comp.graphics.apps.lightwaveHi Everyone, I'm a newbie on 3d graphics and I take opportunity to salute the whole ... Lightwave yet because first I want to learn many things. > > I just have a question ... [Javascript] Newby Question: IE7 Setup - lists.evolt.org - Workers ...Hello, I should have explained in my previous post, That Tim explained that the 'exit' command isn't a reserved word, but it obviously works on some computers, but ... Re: [Echovnc-users] Stupid newby questions - echoserver ...Re: [Echovnc-users] Stupid newby questions - echoserver performance, rdp without servermirror? Rob Hoerning Tue, 21 Apr 2009 06:54:26 -0700 7/23/2012 8:01:54 AM
|