Why do circular references and recursion make my program fail?

后端 未结 4 1262
耶瑟儿~
耶瑟儿~ 2021-01-14 10:28

I wrote this simple Prolog program.

man(socrates).
mortal(X) :- man(X).
immortal(X) :- immortal(X).

I asked it the usual questions, such as

4条回答
  •  [愿得一人]
    2021-01-14 11:23

    Using tabling with XSB:

    :- table foo/1.
    
    foo(X) :- foo(X).
    
    bar(X) :- bar(X).
    

    and then:

    | ?- [tabled].
    [tabled loaded]
    
    yes
    | ?- foo(1).
    
    no
    | ?- bar(1).    % does not finish
    

提交回复
热议问题