Prolog (database)
started 5/22/2001; 10:18:24 AM - last post 5/23/2001; 4:20:01 AM
|
|
Lai - Prolog (database)
5/22/2001; 10:18:24 AM (reads: 424, responses: 9)
|
|
Can anyone help me in Prolog (database)? Or any good website i should visit? What the url for the google discussion site?
|
|
andrew cooke - Re: Prolog (database)
5/22/2001; 11:54:37 AM (reads: 441, responses: 0)
|
|
|
Chris Rathman - Re: Prolog (database)
5/22/2001; 2:39:40 PM (reads: 456, responses: 0)
|
|
There was a post here last month on RDF & Prolog. Follow the links and you'll find more Prolog information than you could possibly read in a lifetime. A couple of starting places off the top of my head: The Prolog FAQ and Quick Prolog.
Just an aside, but when I delved into Prolog a while back, I found SWI Prolog to be the most accessible of the available environments.
|
|
Lai - Re: Prolog (database)
5/22/2001; 10:00:08 PM (reads: 435, responses: 1)
|
|
Wow, thankz for your quick response. I really appreciate it. May be I could look for help in here rather using google.
My problem is, if the below predicate.
% person(Name, Age)
person('tom', 15).
person('mary', 16).
person('annie', 18).
person('jones', 15).
% List the name
person_name(Name):-
person(Name, _).
And according to the query below, it should be...
?- person_name(Name).
Name = tom ;
Name = mary ;
Name = annie ;
Name = jones
But I've only got this
Name = tom
Yes
So, what the problem? I want to list all the names.
|
|
andrew cooke - Re: Prolog (database)
5/22/2001; 11:23:25 PM (reads: 430, responses: 0)
|
|
You get one name at a time. Press ";" to see the next.
This is just the behaviour of the interactive Prolog top level loop - in a program all values are available.
There's a good intro to Prolog that you might enjoy (it explains things at this level) at http://www.amzi.com/AdventureInProlog/index.htm (this question is answered in Section 3 - Simple Queries).
|
|
Ehud Lamm - Re: Prolog (database)
5/23/2001; 12:49:59 AM (reads: 408, responses: 0)
|
|
Indeed.
The best place to post such questions is on the newsgroup comp.lang.prolog (the link is to the Google archive). Lambda can't compete with groups that are dedicated to specific languages, and shouldn't try...
|
|
Lai - Re: Prolog (database)
5/23/2001; 1:01:52 AM (reads: 398, responses: 1)
|
|
What if i want the listing to be Name = [tom, mary, annie, jones]?
|
|
andrew cooke - Re: Prolog (database)
5/23/2001; 1:18:42 AM (reads: 419, responses: 0)
|
|
Read the links I've suggested or ask on usenet (comp.lang.prolog). The whole point of documentation and on-line guides is that *you* read it; not that I read it and then repeat it to you.
|
|
Ehud Lamm - Re: Prolog (database)
5/23/2001; 3:20:01 AM (reads: 396, responses: 0)
|
|
One should note that collecting the results into a list is rather an advanced reature, and usually NOT what you need as a beginner (but check bagof and setof)
|
|
Lai - Re: Prolog (database)
5/23/2001; 4:20:01 AM (reads: 425, responses: 0)
|
|
I've seen this bagof and setof thing. But just wondering whether i can do this stuff in other way, i mean developing our own predicate rather using the built in function.
Online? Do you mean we can chat online at comp.lang.prolog about our query?
And one more query, how should the predicate goes if i want to sum up the age?
|
|
|
|