I copied the source code to my computer, because it is more natural for me to use SWI-Prolog there.
In loading the source into SWI-Prolog using consult/1 I receive the following errors:
Warning: c:/users/eric/documents/projects/prolog/swi-discourse_001.pl:529:
Clauses of jogo/11 are not together in the source-file
Earlier definition at c:/users/eric/documents/projects/prolog/swi-discourse_001.pl:48
Current predicate: jogo/13
Use :- discontiguous jogo/11. to suppress this message
Warning: c:/users/eric/documents/projects/prolog/swi-discourse_001.pl:597:
Clauses of jogo/11 are not together in the source-file
Earlier definition at c:/users/eric/documents/projects/prolog/swi-discourse_001.pl:48
Current predicate: jogo/9
Use :- discontiguous jogo/11. to suppress this message
Warning: c:/users/eric/documents/projects/prolog/swi-discourse_001.pl:919:
Clauses of jogo/13 are not together in the source-file
Earlier definition at c:/users/eric/documents/projects/prolog/swi-discourse_001.pl:528
Current predicate: jogo/11
Use :- discontiguous jogo/13. to suppress this message
Warning: c:/users/eric/documents/projects/prolog/swi-discourse_001.pl:920:
Clauses of jogo/11 are not together in the source-file
Earlier definition at c:/users/eric/documents/projects/prolog/swi-discourse_001.pl:48
Current predicate: jogo/13
Use :- discontiguous jogo/11. to suppress this message
Warning: c:/users/eric/documents/projects/prolog/swi-discourse_001.pl:1264:
Clauses of jogo/11 are not together in the source-file
Earlier definition at c:/users/eric/documents/projects/prolog/swi-discourse_001.pl:48
Current predicate: jogo/10
Use :- discontiguous jogo/11. to suppress this message
The first error
Warning: c:/users/eric/documents/projects/prolog/swi-discourse_001.pl:529:
Clauses of jogo/11 are not together in the source-file
Earlier definition at c:/users/eric/documents/projects/prolog/swi-discourse_001.pl:48
Current predicate: jogo/13
Use :- discontiguous jogo/11. to suppress this message
Line 48 is the first data line
jogo(1,celtics,philadelphia,21,21,26,21,30,24,28,21).
and has 11 parameters.
Line 529 is
jogo(3,philadelphia,raptors,29,30,36,29,26,20,35,22).
and has 11 parameters.
but line 528 is
jogo(3,wizards,suns,33,29,22,26,28,24,26,30,40,37).
and has 13 parameters.
SWI-Prolog expects all predicates with the same name, e.g. (jogo) and arity to be listed in order in the code.
The cause of this error message is that the predicate is missing some parameters, or that the predicate has clauses with different arity and the code needs to rearranged to keep the clauses with the same name and arity together.
If I run the query
?- statsEquipa.
Qual a equipa?nets.
ERROR: Arguments are not sufficiently instantiated
ERROR: In:
ERROR: [15] ... + _7042+_7036> ... + _7054+_7048
ERROR: [14] '$bags':findall_loop(jogo(_7100,nets,_7104,_7106,_7108,_7110,_7112,_7114,_7116,_7118,_7120)-1,user:(... > ...),_7088,[]) at c:/program files/swipl/boot/bags.pl:97
ERROR: [13] setup_call_catcher_cleanup('$bags':'$new_findall_bag','$bags':findall_loop(...,...,_7182,[]),_7160,'$bags':'$destroy_findall_bag') at c:/program files/swipl/boot/init.pl:466
ERROR: [9] aggregate:aggregate_all(count,jogo(_7230,nets,_7234,_7236,_7238,_7240,_7242,_7244,_7246,_7248,_7250),user:(... > ...),_7226) at c:/program files/swipl/library/aggregate.pl:258
ERROR: [8] statsEquipa at c:/users/eric/documents/projects/prolog/swi-discourse_001.pl:1287
ERROR: [7] <user>
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
^ Exception: (13) setup_call_catcher_cleanup('$bags':'$new_findall_bag', '$bags':findall_loop(jogo(_6104, nets, _6108, _6110, _6112, _6114, _6116, _6118, _6120, _6122, _6124)-1, user:(_6110+_6114+_6118+_6122>_6112+_6116+_6120+_6124), _6198, []), _7340, '$bags':'$destroy_findall_bag') ? creep
^ Call: (15) call('$bags':'$destroy_findall_bag') ?
I get that you are extracting the points for each team during each period and adding them for a total for the game, e.g. CA+CB+CC+CD
but I don’t understand the purpose of >
, e.g. CA+CB+CC+CD>FA+FB+FC+FD
.
Please explain.