Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如,如果我得到以下谓词:
father('jim', 'Boby') father('rob', 'bob')
我想知道谁让父亲的名字以'bo'开头?
只需使用atom_concat/3ISO Prolog 标准内置谓词。
atom_concat/3
另一个 ISO 选项是sub_atom/5:
sub_atom/5
sub_atom(Atom, Before, Length, After, Sub_atom)
?- sub_atom(bob, 0, _, _, bo). true.
与 相比atom_concat/3,这避免了生成不需要的原子来表示后缀。