Amzi Prolog - Newbie Question 
Author Message
 Amzi Prolog - Newbie Question

Hi,

I have written a query, but it will churn out 4 same tuples even though it
is not repeated in the data.
        scores(A, B, C, D, E, F, G, H, I), D>E, C='Everton'.

Please advise,

Jacky

Query
=====
?- scores(A, B, C, D, E, F, G, H, I), D>E, C='Everton'.

A = 'England'
B = 'Premier League'
C = 'Everton'
D = 2
E = 1
F = 'Aston Villa'
G = 2003
H = 4
I = 26 ;

A = 'England'
B = 'Premier League'
C = 'Everton'
D = 2
E = 1
F = 'Aston Villa'
G = 2003
H = 4
I = 26 ;

A = 'England'
B = 'Premier League'
C = 'Everton'
D = 2
E = 1
F = 'Aston Villa'
G = 2003
H = 4
I = 26 ;

A = 'England'
B = 'Premier League'
C = 'Everton'
D = 2
E = 1
F = 'Aston Villa'
G = 2003
H = 4
I = 26 ;
no

Data
=====
scores('England', 'Premier League', 'Bolton W.', 2, 2, 'Arsenal', 2003, 4,
26).
scores('England', 'Premier League', 'Birmingham C.', 3, 0, 'Middlesbrough',
2003, 4, 26).
scores('England', 'Premier League', 'Charlton Athletic', 2, 1,
'Southampton', 2003, 4, 26).
scores('England', 'Premier League', 'Chelsea', 1, 1, 'Fulham', 2003, 4, 26).
scores('England', 'Premier League', 'Everton', 2, 1, 'Aston Villa', 2003, 4,
26).
scores('England', 'Premier League', 'Leeds U.', 2, 3, 'Blackburn R.', 2003,
4, 26).
scores('England', 'Premier League', 'Sunderland', 0, 1, 'Newcastle U.',
2003, 4, 26).
scores('England', 'Premier League', 'West Bromwich A.', 0, 6, 'Liverpool',
2003, 4, 26).
scores('England', 'Premier League', 'Leeds U.', 2, 0, 'Fulham', 2003, 4,
22).
scores('England', 'Premier League', 'Manchester C.', 0, 1, 'West Ham U.',
2003, 4, 27).
scores('England', 'Premier League', 'Tottenham H.', 0, 2, 'Manchester U.',
2003, 4, 27).
scores('Italy', 'Serie A', 'Como', 0, 0, 'Modena', 2003, 4, 27).
scores('Italy', 'Serie A', 'Reggina', 0, 0, 'Parma', 2003, 4, 27).
scores('Spain', 'Primera Division', 'Valencia', 3, 0, 'Deportivo Alaves',
2003, 4, 27).
scores('Spain', 'Primera Division', 'Mallorca', 3, 0, 'Deportivo La Coruna',
2003, 4, 27).
scores('Spain', 'Primera Division', 'Celta de Vigo', 0, 0, 'Valladolid',
2003, 4, 27).
scores('Spain', 'Primera Division', 'Recreativo Huelva', 5, 0, 'Villarreal',
2003, 4, 27).
scores('Germany', 'Bundesliga I.', 'Kaiserslautern', 1, 0, 'Werder Bremen',
2003, 4, 27).
scores('France', 'Coupe De France', 'Paris S.G.', 2, 0, 'Bordeaux', 2003, 4,
27).
scores('Holland', 'Holland {*filter*} Eredivisie', 'FC Groningen', 0, 0, 'NAC
Breda', 2003, 4, 27).
scores('Holland', 'Holland {*filter*} Eredivisie', 'Feyenoord Rotterdam', 1, 0,
'RBC Roosendaal', 2003, 4, 27).
scores('Portugal', 'Primeira Liga', 'Santa Clara', 1, 0, 'Vitoria Setubal',
2003, 4, 27).
scores('Brazil', 'Campeonato Brasileiro', 'Santos', 4, 0, 'Fortaleza', 2003,
4, 27).
scores('Brazil', 'Campeonato Brasileiro', 'Goias', 7, 0, 'Juventude', 2003,
4, 27).
scores('Brazil', 'Campeonato Brasileiro', 'Figueirense', 0, 0, 'Ponte
Preta', 2003, 4, 27).
scores('Brazil', 'Campeonato Brasileiro', 'Vasco', 1, 0, 'Sao Caetano',
2003, 4, 27).
scores('Mexico', 'Clausura', 'Necaxa', 3, 0, 'Morelia', 2003, 4, 27).
scores('England', 'Premier League', 'Manchester C.', 0, 1, 'West Ham U.',
2003, 4, 27).
scores('England', 'Division I.', 'Leicester C.', 1, 1, 'Norwich C.', 2003,
4, 27).
scores('Italy', 'Serie A', 'Juventus', 2, 1, 'Brescia', 2003, 4, 27).
scores('Italy', 'Serie A', 'Bologna', 1, 1, 'Chievo', 2003, 4, 27).
scores('Italy', 'Serie A', 'Inter Milan', 1, 1, 'Lazio', 2003, 4, 27).
scores('Italy', 'Serie A', 'Piacenza', 5, 1, 'Perugia', 2003, 4, 27).
scores('Italy', 'Serie A', 'Empoli', 1, 1, 'Udinese', 2003, 4, 27).
scores('Spain', 'Primera Division', 'Barcelona', 2, 1, 'Real Sociedad',
2003, 4, 27).
scores('Portugal', 'Primeira Liga', 'Moreirense', 2, 1, 'Gil Vicente', 2003,
4, 27).
scores('Scotland', 'Premier League', 'FC Dundee', 0, 1, 'Kilmarnock', 2003,
4, 27).
scores('Brazil', 'Campeonato Brasileiro', 'Corinthians', 1, 1, 'Flamengo',
2003, 4, 27).
scores('Brazil', 'Campeonato Brasileiro', 'Gremio', 0, 1, 'Fluminense',
2003, 4, 27).
scores('Mexico', 'Clausura', 'Guadalajara (Chivas)', 1, 1, 'Monterrey',
2003, 4, 27).
scores('Mexico', 'Clausura', 'Pachuca', 0, 1, 'Toluca', 2003, 4, 27).
scores('Mexico', 'Clausura', 'Santos', 4, 1, 'U.N.A.M. (Pumas)', 2003, 4,
27).
scores('England', 'Premier League', 'Tottenham H.', 0, 2, 'Manchester U.',
2003, 4, 27).
scores('England', 'Division I.', 'Portsmouth', 3, 2, 'Rotherham U.', 2003,
4, 27).
scores('Spain', 'Primera Division', 'Malaga', 2, 2, 'Racing Santander',
2003, 4, 27).
scores('Germany', 'Bundesliga I.', 'Arminia Bielefeld', 2, 2, 'Energie
Cottbus', 2003, 4, 27).
scores('Holland', 'Holland {*filter*} Eredivisie', 'NEC Nijmegen', 1, 2, 'FC
Utrecht', 2003, 4, 27).
scores('Portugal', 'Primeira Liga', 'Varzim', 0, 2, 'Uniao Leiria', 2003, 4,
27).
scores('Scotland', 'Premier League', 'Rangers', 1, 2, 'Celtic', 2003, 4,
27).
scores('Brazil', 'Campeonato Brasileiro', 'Atletico Paranaense', 5, 2,
'Criciuma', 2003, 4, 27).
scores('Brazil', 'Campeonato Brasileiro', 'Paysandu', 5, 2, 'Sao Paulo',
2003, 4, 27).
scores('Spain', 'Primera Division', 'Rayo Vallecano', 0, 3, 'Espanyol',
2003, 4, 27).
scores('Spain', 'Primera Division', 'Sevilla', 1, 3, 'Real Madrid', 2003, 4,
27).
scores('Holland', 'Holland {*filter*} Eredivisie', 'AZ Alkmaar', 1, 3, 'Ajax
Amsterdam', 2003, 4, 27).
scores('Portugal', 'Primeira Liga', 'Pacos Ferreira', 3, 3, 'Nacional',
2003, 4, 27).
scores('Belgium', 'Jupiler League', 'Lokeren', 0, 5, 'Anderlecht', 2003, 4,
27).



Fri, 14 Oct 2005 13:45:03 GMT  
 Amzi Prolog - Newbie Question

Quote:
> Hi,

> I have written a query, but it will churn out 4 same tuples even though it
> is not repeated in the data.
>         scores(A, B, C, D, E, F, G, H, I), D>E, C='Everton'.

> Please advise,

> Jacky

[...]

Jacky,

I just copied the data you posted into Amzi! Prolog 6.2.14 and tried
your query - this is the result:

?- scores(A, B, C, D, E, F, G, H, I), D>E, C='Everton'.

A = 'England'
B = 'Premier League'
C = 'Everton'
D = 2
E = 1
F = 'Aston Villa'
G = 2003
H = 4
I = 26 ;
no
?-

Are you sure the data is the same? And the query is exactly as posted?
Which version of Amzi! Prolog are you using?

John



Fri, 14 Oct 2005 16:50:40 GMT  
 Amzi Prolog - Newbie Question

Quote:
> Are you sure the data is the same? And the query is exactly as posted?
> Which version of Amzi! Prolog are you using?

Strange, I got it now...........I'm using "Amzi! Prolog + Logic Server
6.2.14", just downloaded from the net.

btw, how do you write a 'function' in the program where you store the data?
I tried something like:
        HomeWin(Team) :- scores(A, B, C, D, E, F, G, H, I), D>E, C=Team.

But it yeilds:
        Unexpected Error - Read Buffer
        HomeWin( **NEAR HERE** Team) :- scores(A, B, C, D, E, F, G, H, I),
D>E, C=Team.

Pls advise,

Jacky



Fri, 14 Oct 2005 20:12:45 GMT  
 Amzi Prolog - Newbie Question
And I tried something like in the Listener:
        HomeWin :- scores(A, B, C, D, E, F, G, H, I), C='Everton'.

And it yeilds:
        Compliation Error, and closes the program.

I'm using WinXP, and recently my ICQ2003 gives me an Microsoft Visual C++
Runtime Error when it starts, I wonder if they're related.

Thanks,

Jacky



Fri, 14 Oct 2005 20:20:35 GMT  
 Amzi Prolog - Newbie Question

Quote:
>I tried something like:
>        HomeWin(Team) :- scores(A, B, C, D, E, F, G, H, I), D>E, C=Team.

>But it yeilds:
>        Unexpected Error - Read Buffer
>        HomeWin( **NEAR HERE** Team) :- scores(A, B, C, D, E, F, G, H, I),
>D>E, C=Team.

Predicate names should start with a lowercase letter.
Try "homeWin" rather than "HomeWin".

--

The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.



Fri, 14 Oct 2005 21:49:47 GMT  
 Amzi Prolog - Newbie Question

Quote:
> Predicate names should start with a lowercase letter.
> Try "homeWin" rather than "HomeWin".

opps, basic errors...........it would cause Amzi Prolog to shutdown?
interesting..........


Fri, 14 Oct 2005 22:24:25 GMT  
 Amzi Prolog - Newbie Question
Thanks for the prompt responses!

another question:

How do I display all the information? I can't do write(A B). or write(A, B).
    homeWin(Team) :- scores(A, B, C, D, E, F, G, H, I), D>E, C=Team,
write(A).



Fri, 14 Oct 2005 22:38:53 GMT  
 Amzi Prolog - Newbie Question

Quote:
> How do I display all the information? I can't do write(A B). or write(A,
B).
>     homeWin(Team) :- scores(A, B, C, D, E, F, G, H, I), D>E, C=Team,
> write(A).

found out I could that that by using:
        homeWin(Team) :- scores(A, B, C, D, E, F, G, H, I), D>E, C=Team,
write(A), write(', '), write(B).

but is there a shorter way to write the following?
        write(A), write(', '), write(B), write(', '), write(C), write(', '),
write(D), write(', '), write(E), write(', '), write(F).

Thanks,

Jacky



Fri, 14 Oct 2005 22:46:40 GMT  
 Amzi Prolog - Newbie Question

Quote:
>is there a shorter way to write the following?
>        write(A), write(', '), write(B), write(', '), write(C), write(', '),
>write(D), write(', '), write(E), write(', '), write(F).

Try this:

        write((A,B,C,D,E,F))

--

The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.



Sat, 15 Oct 2005 15:14:52 GMT  
 Amzi Prolog - Newbie Question
We're looking into that.

Thanks,
Mary Kroening
Amzi! inc.


Quote:
> > Predicate names should start with a lowercase letter.
> > Try "homeWin" rather than "HomeWin".

> opps, basic errors...........it would cause Amzi Prolog to shutdown?
> interesting..........



Sun, 16 Oct 2005 02:25:36 GMT  
 Amzi Prolog - Newbie Question

Quote:
> We're looking into that.

> Thanks,
> Mary Kroening
> Amzi! inc.

Howdy! Thanks for noticing!

btw, your copy&paste don't work really well, to get an idea of it, try
copy&paste in notepad,

it shouldn't allow keyboard arrows to go up to previous screen, it should
allow mouse to copy and paste from previous, not cursors,

but it's a good product, but UOL recommends SWI-Prolog, good luck! :)



Mon, 17 Oct 2005 23:25:59 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. Amzi! Prolog Question (Image Save)

2. Amzi Prolog versus LPA Prolog.

3. Amzi-Prolog vs. Visual Prolog

4. newbie prolog question (sorting in prolog)

5. Searching Amzi Prolog with Smalltalk examples

6. Amzi Prolog - Warplan exame: extending it

7. Amzi Prolog for the Web

8. Amzi! Prolog

9. Random in Amzi Prolog

10. How Do I: Browser-Enable Amzi Prolog Program

11. Amzi Prolog and SQL Server

12. How to use COM with Amzi Prolog

 

 
Powered by phpBB® Forum Software