Prolog-style unification?

Ype Kingma ykingma at accessforall.nl
Sun Jun 8 14:42:56 EDT 2003


Simon Burton wrote:

>
> On Sat, 07 Jun 2003 14:38:40 -0600, junk wrote:
>
>> Hi Robert,
>>
>> I am working on a Master's Thesis currently where this issue is of
>> concern.  I would also like to know if there is such a module.
>>
>> In the mean time, I have written my own module which does a pretty good
>> job of simulating Prolog style calls.  Here is what my syntax looks like
>> right now:
>>
>> import logic
>> Father = logic.Fact()
>> Father("Seth","Alex")
>> Father("James","Seth")
>> X = logic.LogicalVariable()
>> Y = logic.LgocialVariable()
...

>> while Father(X,Y):
>>     print X, Y
>
> Know about iterators?
>
> i'd like to see
> for x,y in Father():
>   print x, y
>
> are you trying too hard to adhere to prolog syntax maybe?
>

Calling Father this way could make it difficult to use it
in multiple places in a single clause. An iterator per occurence
seems just right, although I have to say that it
is decades ago that I used Prolog...

Some questions:
Is logic.Fact the good class for the backtracking needed?
Do you use 'yield' for backtracking?

Have fun,
Ype



--
email at xs4all.nl




More information about the Python-list mailing list