Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>

WEEK'S BEST

  • BackTrack 5 R1
  • Wine 1.2.3 / 1.4 RC3
  • Mozilla Firefox 10...
  • Ubuntu 11.04
  • Angry Birds 1.1.2.1
  • Ubuntu 10.04.3 LTS
  • Linux Kernel 3.2.6
  • Ubuntu Manual 10.10
  • Adobe Flash Player...
  • Pidgin 2.10.1
  • Home > Linux > Programming > Libraries

    AI::Prolog::Builtins 0.739

    Download button

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

    License / Price:

    Last Updated:

    Category:
    Curtis Poe | More programs
    Perl Artistic License / FREE
    June 22nd, 2007, 00:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    AI::Prolog::Builtins description

    AI::Prolog::Builtins is a Perl module with builtin predicates that AI::Prolog supports.

    AI::Prolog::Builtins is a Perl module with builtin predicates that AI::Prolog supports.

    Comments

    Comments begin with a % and terminate at the end of the line or begin with /* and terminate with */.

    Variables

    As in Prolog, all variables begin with an upper-case letter and are not quoted. In the following example, STUFF is a variable.

    steals(badguy, STUFF, "Some rich person").

    Constants

    Constants begin with lower-case letters. If you need a constant that begins with an upper-case letter or contains spaces or other non-alphanumeric characters, enclose the constant in single or double quotes The quotes will not be included in the constant.

    In the following example, badguy and Some rich person are both constants:

    steals(badguy, STUFF, "Some rich person").

    Miscellaneous

    This will not work:

    p(X) :- X. /* does not work */

    Use this instead:

    p(X) :- call(X).

    BUILTINS

    !/0

    The "cut" operator. This is used when you wish to tell Prolog that you only need to satisfy a goal once. For example, if you wish to deny someone the right to rent videos if they have overdue videos, you might use the cut operator as soon as you see they have any overdue video. The fact that they have more than one overdue video doesn't matter.

    See the cut.pl program in the examples/ directory that comes with this distribution.

    assert/1

    Add new facts to the database. Only facts can be added, not rules. This may change in the future. See retract(X).

    assert(loves(ovid,perl)).

    call/1

    Invokes X as a goal.

    consult/1

    Supplied the name of a file containing Prolog code, this will consult the Prolog code in the file and add its contents to the current knowledgebase.

    Will warn if the file cannot be opened.

    div/2

    Succeeds if both terms are bound. The value of the term is X / Y. Use with is(X,Y).

    is(X, div(N,3)).

    This is the internal form of the infix operator:

    N / 3.

    eq/2

    Succeeds if X and Y are equal.

    This is the internal form of the infix operator:

    X == Y.

    fail/0

    This goal always fails. Useful when you've reached a condition you know should not succeed.

    kill(Hero, Beast) :-

    not(has_weapon(Hero)), fail.

    ge/2

    Succeeds if both terms are bound and X >= Y.

    This is the internal form of the infix operator:

    X >= Y.

    gt/2

    Succeeds if both terms are bound and X > Y.

    This is the internal form of the infix operator:

    X > Y.

    halt/1

    In the aiprolog shell, exist shell. Currently has no other effect.

    if/3

    If X succeeds as a goal, try Y as a goal. Otherwise, try Z.

    thief(badguy).

    steals(PERP, X) :-

    if(thief(PERP), eq(X,rubies), eq(X,nothing)).

    is/2

    If X is unbound and Y is bound to a number, the goal succeeds and X becomes bound to the value of Y. Otherwise, succeeds if both terms are bound, numbers, and equal.

    All other conditions result in failure.

    This is the internal form of the infix operator:

    X is Y.

    le/2

    Succeeds if both terms are bound and X

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    builtin predicates | AI::Prolog predicates | Perl module | AI::Prolog::Builtins | builtin | AI::Prolog



    HTML code for linking to this page:


    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

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