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.
このような文法規則を節に翻訳したい
char(C) --> [C], { code_type(C, graph), \+ memberchk(C, "()") }.
しかし、動作しません
char(C,In,Out):- In=[C|Out], code_type(C, graph), \+ memberchk(C, "()").
組み込みの Prolog 述語を使用して、expand_term/2文法規則を節に展開できます。
expand_term/2
?- expand_term((char(C) --> [C], { code_type(C, graph), \+ memberchk(C, "()") }), Clause). Clause = (char(C, [C|_G1665], _G1651):- (code_type(C, graph), \+memberchk(C, [40, 41])), _G1651=_G1665).