Resolution with Prolog

2

Good afternoon,

I have encountered a problem with my teacher in the Prolog class. My professor says that we can make a resolution with the following program

mag(paris,mag_a).
mag(paris,mag_b).
mag(lyon,mag_c).
mag(lyon,mag_d).
liste(M):-mag(V,M),write(M),write( situe_a ),write(V),nl,fail.
liste(M):-write(fin liste).

served by the following goal:

liste(X)

and that gives the following result:

   mag_a situe a paris
   mag_b situe a paris
   mag_c situe a lyon
   mag_d situe a lyon
   fin liste
   true.

But, in swish.swi, the software that compiles Prolog online says that it is not possible to do that:

So, who can I believe?

    
asked by ThePassenger 27.04.2016 в 00:13
source

1 answer

2

I do not understand what the problem is that you want to solve, but I do believe that in the last line there is a syntax error. If you send two parameters to write they should be separated by a comma.

That is,

liste(M):-write(fin, liste).
    
answered by 27.04.2016 / 00:24
source