Then, at the top level, we have this simple predicate that accepts any [compound] prolog term and extracts the unique set of atoms found within by the worker predicate via setof/3:expression_atoms( T , As ) :- % To get the set of unique atoms in an arbitrary term, compound(T) , % - ensure that's its a compound term, T =.. [_|Ts] , % - decompose it, discarding the functor and keeping the arguments setof(A,expression_atom(Ts,A),As) % - invoke the worker predicate via setof/3 . % Easy! 这篇关于Prolog 程序返回命题公式中的原子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-10 23:47