Logic programming with Iterators

Wesner Moise has a fantastic blog post on how iterators and Expressions can be used to implement backtracking:

It turns out that it is possible to implement logic programming in C# natively through the use of iterators.  

grandparent(x, z) :– parent(x, y), parent(y, z). parent(jebbush, gpbush). parent(ghwbush, gwbush). parent(ghwbush, jebbush). 

The above rules in Prolog could be translated into following C# code: http://wesnerm.blogs.com/net undocumented/2005/12/iterators and n.html

 

Comments are closed.