What is the difference between ' and " in Prolog?

前端 未结 2 1640
陌清茗
陌清茗 2020-11-22 01:54

I am new to Prolog and noticed that \' and \" give different behavior, but am curious as to why. Specifically, when loading a file, ?- [\'test1.pl\']. works, w

2条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-22 02:34

    Strings in Prolog are written in single quotes. Terms written in double quotes are immediately converted to a list of character codes.

    ?- write('sdf').
    sdf
    true.
    
    ?- write("sdf").
    [115, 100, 102]
    true.
    

提交回复
热议问题