Discussions related to Visual Prolog
Martin Meyer
VIP Member
Posts: 358
Joined: 14 Nov 2002 0:01

List unification

Post by Martin Meyer »

Hello Thomas,

please check this case (in VIP build 1112):

Code: Select all

class predicates     test : (unsigned*, unsigned*). clauses     test(As, Bs) :-         if [[As, [X]]] = [[[X], Bs]] then             stdIO::write("unifies")         else             stdIO::write("not unfiable")         end if.   clauses     run() :-         test([1], [1]).
It outputs "not unifiable".
Regards Martin
sbishop61
Posts: 20
Joined: 9 May 2021 9:55

Re: List unification

Post by sbishop61 »

I may be missing the logic you are implementing/testing.

If it unification based on there being a list X that when appended to A gives the same list prefixed to B; then the following 'works':

Code: Select all

test(As, Bs) :-         if [As, [X]] = [[X], Bs] then             stdIO::write("unifies")         else             stdIO::write("not unfiable")         end if.
If I am misunderstanding, my apologies.
Martin Meyer
VIP Member
Posts: 358
Joined: 14 Nov 2002 0:01

Re: List unification

Post by Martin Meyer »

You are not misunderstanding. My code contains unnecessary complications and can be simplified.

I am reporting the example only to contribute to the perfection of the compiler. The compiler is a magnificent technical masterpiece, it is desirable to eliminate any bug.
Regards Martin
User avatar
Thomas Linder Puls
VIP Member
Posts: 1483
Joined: 28 Feb 2000 0:01

Re: List unification

Post by Thomas Linder Puls »

Thank you Martin, we will of course investigate this problem.
Regards Thomas Linder Puls
PDC