Yield Prolog

Embed Prolog in your code
Download

Yield Prolog Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Jeff Thompson
  • Publisher web site:

Yield Prolog Tags


Yield Prolog Description

Embed Prolog in your code Yield Prolog is a software that lets you embed Prolog programs directly in Python, C# or JavaScript by using the yield keyword. For example, here is the classic "uncle" predicate in Prolog:uncle(Person, Uncle) :- parent(Person, Parent), brother(Parent, Uncle).(This says that a person has an uncle if the person has a parent and that parent has a brother.) And here it is in Yield Prolog:Pythondef uncle(Person, Uncle): Parent = Variable() for l1 in parent(Person, Parent): for l2 in brother(Parent, Uncle): yield FalseC#IEnumerable< bool > uncle(object Person, object Uncle) { Variable Parent = new Variable(); foreach (bool l1 in parent(Person, Parent)) { foreach (bool l2 in brother(Parent, Uncle)) yield return false; }}JavaScriptfunction uncle(Person, Uncle) { var Parent = new Variable(); for each (var l1 in parent(Person, Parent)) { for each (var l2 in brother(Parent, Uncle)) yield false; }}As you can see, the flow of the code in Yield Prolog is similar to Prolog. The Tutorial explains how these examples work, without expecting you to know Prolog. And the benchmarks show that Yield Prolog in C# can be faster than efficient Prolog systems like Yap Prolog and XSB.Yield Prolog is made possible by the yield keyword, which automatically creates iterators that you can nest, combined with Yield Prolog's Variable class which can unify a variable with other values (just like in Prolog). There is no "API" standing between your code and Yield Prolog, because you just use the yield keyword to make "iterator functions" wherever you need them. Yield Prolog is part of your code, which can mix Prolog-style predicates directly with ordinary arrays, file I/O, GUI calls and all your own classes. Because it lets you mix these, Yield Prolog unifies the declarative and procedural programming models.


Yield Prolog Related Software