Representing data structures in Prolog
From: Alfonso Esteban Gonzalez Sencion (sencion_at_alcatel.es)
Date: 02/16/04
- Next message: Bart Demoen: "Re: Egg on my face, I guess I still have trouble with declarative thinking at times."
- Previous message: Paul Singleton: "Re: Egg on my face, I guess I still have trouble with declarative thinking at times."
- Next in thread: chavez: "Re: Representing data structures in Prolog"
- Reply: chavez: "Re: Representing data structures in Prolog"
- Reply: Tom Breton: "Re: Representing data structures in Prolog"
- Reply: Bill Spight: "Re: Representing data structures in Prolog"
- Reply: Alfonso Esteban Gonzalez Sencion: "Re: Representing data structures in Prolog"
- Reply: Emile: "Re: Representing data structures in Prolog"
- Reply: Paul Singleton: "Re: Representing data structures in Prolog"
- Reply: Michael D. Kersey: "Re: Representing data structures in Prolog"
- Reply: Christopher Browne: "Re: Representing data structures in Prolog"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 16 Feb 2004 12:04:09 +0100
Hello all.
I am using SWI-Prolog for verifying the configuraiton of the informacion
of a traffic control system. I find Prolog very convenient because of
the ease of writing new rules with which to test the coherence of the
system. Unfortunatley I have some difficulties with the representation
of knowledge with Prolog.
My problem is the following. I have several facts of the form.
one_fact(par1,par2,par3,par4,par5,par6,.....,parn).
another_fact(par1,par3,par4,par5,par6,......,parn).
As you see each fact has a substantial number of parameters and some
of them may be optional.
When I want to match one of the facts to get some of parameters I
usually do the following.
onefact(_,_,_,_,_,_,_,X,_,_,_,_N,....,_,_)
As you see I have to be careful with the number and positions of the '_'
and also with the variables postions. That I find it very error prone.
So far I have been geting around the problem using a limited number of
parameters but I would like to represent all the information.
So, the question is. Is there a better way of representing the
information in prolog? Something similar to a structure in C or an
object in object oriented languages. For example:
object.fieldname(X).
Thanks in advance
- Next message: Bart Demoen: "Re: Egg on my face, I guess I still have trouble with declarative thinking at times."
- Previous message: Paul Singleton: "Re: Egg on my face, I guess I still have trouble with declarative thinking at times."
- Next in thread: chavez: "Re: Representing data structures in Prolog"
- Reply: chavez: "Re: Representing data structures in Prolog"
- Reply: Tom Breton: "Re: Representing data structures in Prolog"
- Reply: Bill Spight: "Re: Representing data structures in Prolog"
- Reply: Alfonso Esteban Gonzalez Sencion: "Re: Representing data structures in Prolog"
- Reply: Emile: "Re: Representing data structures in Prolog"
- Reply: Paul Singleton: "Re: Representing data structures in Prolog"
- Reply: Michael D. Kersey: "Re: Representing data structures in Prolog"
- Reply: Christopher Browne: "Re: Representing data structures in Prolog"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|