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.
我有一个要转换为列表的字符串:
"a + b = c"
我需要它以列表格式将其传递给成员规则。当我直接将它传递给成员规则时,它会作为一系列数字传递,我认为这是它们的字符代码,但我想要实际的字符。如何将其放入列表中,然后将其与规则一起使用。我是 Prolog 的新手,所以我将不胜感激。
SWI-Prolog 具有 string_chars/2,但您可以使用 2 个符合 ISO 的谓词获得相同的值
?- atom_codes(A, "a + b = c"), atom_chars(A, Cs). A = 'a + b = c', Cs = [a, ' ', +, ' ', b, ' ', =, ' ', c].