Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Interpreters

    Yield Prolog 1.0.3

    Download button

    No screenshots available
    Downloads: 844  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Jeff Thompson | More programs
    BSD License / FREE
    November 9th, 2008, 02:19 GMT
    ROOT / Programming / Interpreters

     Read user reviews (0)  Refer to a friend  Subscribe

    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:

    Python


    def uncle(Person, Uncle):
     Parent = Variable()
     for l1 in parent(Person, Parent):
     for l2 in brother(Parent, Uncle):
     yield False


    C#

    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;
     }
    }


    JavaScript

    function 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.


    Product's homepage

      


    TAGS:

    embed Prolog | yield keyword | Python interpreter | Python | C# | Javascript

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM