Paulo Moura wrote: > On 2007/01/06, at 23:25, Philippe de Rochambeau wrote: > > >> Could someone please explain why my procedure clauses should be >> "consecutive"? >> > > See the ECLiPSe documentation on the discontiguous/1 directive. > > Paulo > > > The discontigous directive allow claises for predicates to be discontigous, but it is generally not a good idea to have discontigous definitions of predicates -- it is best to keep all the clauses for a particular predicate together, In Philippe's example: wizard(ron). hasWand(harry). wizard(X):- hasBroom(X), hasWand(X). The definition of wizard/1 is seperated by the defintion of hasWand/1. You can keep your definitions together in this way: wizard(ron). wizard(X) :- hasBroom(X), hasWand(X). hasWand(harry). .. You should keep your definitions for a predicatde together because it is easier to read and uinderstand your code, and also it is easier to catch spelling errors in the predicate names -- if you have many wizard/1 clauses, and one of them is misspelt (e.g. you have wizrd(harry) instead of wizard(harry)), this will show up as a discontigous error if wizd(harry) is not the last clause of your wizard/1 definitions). Cheers Kish ShenReceived on Sun Jan 07 2007 - 19:32:29 CET
This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:57 CET