5
|
Vivin Paliath · 技术社区 · 14 年前 |
![]() |
1
5
而swi-prolog中的原子可以用单引号表示,例如,
如果没有单引号的字符序列以其他任何字符开头,例如数字
|
![]() |
2
4
这不是特定于SWI的行为-这是标准要求的。 有一个简单的方法可以看到这一点。你也可以用这个 语法不明显的任何其他术语。在顶层键入: ?- X = 'test'. X = test. ?- X = 'this is a test'. X = 'this is a test'. 答案总是有效的prolog文本-这是特定于swi的,但是 也适用于许多其他prolog系统,如yap、gnu、b、if、sicstus。 另一种方法是使用write_canonical/1: ?- write_canonical('this is a test'). 'this is a test' true. ?- write_canonical([a,b,(c,d),{e,f}]). '.'(a,'.'(b,'.'(','(c,d),'.'({}(','(e,f)),[])))) |