biology daily - the biology and biochemistry encyclopedia
biology daily articles and research Encyclopedia Dictionary Forums biology research links Weblinks Pictures Articles Blogs Newsletter

Visual Prolog

Visual Prolog, also formerly known as PDC Prolog and Turbo Prolog. Visual Prolog is a strongly-typed object-oriented extension of Prolog. As Turbo Prolog it was marketed by Borland, but it is now developed and marketed by the Danish firm Prolog Development Center (PDC) that originally produced it.

Visual Prolog is compiled rather than interpreted, as is traditional for logic languagues.

The core of Visual Prolog are Horn clauses like in Prolog, but unlike to Prolog Visual Prolog has always been strongly typed. Since version 6.0 the language has been fully object-oriented.

Hanoi Example

class hanoi
   predicates
       hanoi : (unsigned N).
end class hanoi

implement hanoi
   domains
       pole = string.

   clauses
       hanoi(N) :- move(N, "left", "centre", "right").

   class predicates
       move : (unsigned N, pole A, pole B, pole C).
   clauses
       move(0, _, _, _) :- !.
       move(N, A, B, C) :-
           move(N-1, A, C, B),
           stdio::writef("move a disc from % pole to the % pole\n", A, B),
           move(N-1, C, B, A).
end implement hanoi

goal
   console::init(),
   hanoi::hanoi(4).

See also

External links



07-14-2008 23:18:10
The contents of this article are licensed from Wikipedia.org under the GNU Free Documentation License. How to see transparent copy
BiologyDaily.com 2005. Legal info   Privacy