3

Prolog でアサートを使用して定義する述語がいくつかあります。

current_predicate/1アサートが実行されたかどうかを知るために使用しています (1 つの値のみをアサートする必要があります)。

しかし、swipl不平を言い続けます:

Warning: The predicates below are not defined. If these are defined
Warning: at runtime using assert/1, use :- dynamic Name/Arity.
Warning: 
Warning: amountOfStudentsInCourseAsserted/2, which is referenced by

そこで、 を追加したの:- dynamic amountOfStudentsInCourseAsserted/2ですが、残念ながら、これは述語を current_predicate(Predicate). に追加します。したがってcurrent_predicate/1、この動的ネーミングを使用していると、もう使用できません。

current_predicate/1動的な名前には当てはまらない別の述語はありますか?

4

2 に答える 2

1

predicate_property/2組み込みの述語とnumber_of_clauses/1プロパティを交互に使用できます。

于 2015-12-27T23:40:12.087 に答える