2012-03-23 6 views
0

次の2つのルールの最後に「Operator Expected」エラーが表示されますが、理由を理解できません。Prolog:Operator予想されます

testDrivenChecking :- 
%Stores all the methods of the projet which are tested by a unit test 
findall(allTestedMethods, 
    (create(allTestMethods, 'method', _, _), 
     addProperty(allTestMethods, 'annotation', 'Test', _, _), %Method created and ensures that it's a test. 
     not(delete(allTestMethods, 'method', _, _)), %The test should not be deleted 
     addReference(allTestMethods, 'calls', allTestedMethods, _, _), 
     not(remReference(allTestMethods, 'calls', allTestedMethods, _, _))), %Ensures that the test keep testing the method 
    allTestedMethodsList), 
list_to_set(allTestedMethodsList, allTestedMethodSet), 

%Stores all the methods of the project which are not tests or main 
findall(allMethods, 
    (create(allMethods, 'method', _, _), 
     not(addProperty(allMethods, 'annotation', 'Test', _, _)), 
     not(addProperty(allMethods, 'name', 'main', _, _)), 
    allMethodsList), 
list_to_set(allMethodsList, allMethodsSet), 

%Intersection gives the set of methods which are not tested in restMethods 
intersection(allTestedMethodSet, allMethodSet, restMethods), 

%Gives the lengths of each set 
length(allTestedMethodSet, LengthTest), 
length(allMethodSet, LengthMethods), 
length(restMethods, LengthRest). 

私は何時間も探していますが、なぜ私はうまくいかないのか分かりません。

答えて

2

これ:

findall(allMethods, 
     (create(allMethods, 'method', _, _), 
     not(addProperty(allMethods, 'annotation', 'Test', _, _)), 
     not(addProperty(allMethods, 'name', 'main', _, _)), 
     allMethodsList), 

あるべき:

findall(allMethods, 
     (create(allMethods, 'method', _, _), 
     not(addProperty(allMethods, 'annotation', 'Test', _, _)), 
     not(addProperty(allMethods, 'name', 'main', _, _))), 
     allMethodsList), 

注4行目の追加の閉じ括弧。

0

また、not/1は昔の遺物であることにも注意してください。標準の(\+)/1組み込み述部を代わりに使用することを検討してください。

関連する問題