How to use list constructors (./2) in SWI-Prolog

后端 未结 2 546
执念已碎
执念已碎 2020-12-20 23:17

I am trying to use list constructor in SWI-Prolog, but am getting \'dict\' expected error.

For example,

.(a, []) == [a].

ERROR: Type error: `dict\         


        
2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-20 23:49

    Better to use | in conventional notation,

    ?- X = '[|]'(1,[0]).
    X = [1, 0].
    

    can be write like this

    ?- X = [1|[0]].
    X = [1, 0].
    

提交回复
热议问题