Jump to content

Visual Prolog

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 212.130.82.202 (talk) at 22:49, 14 April 2005. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Visual Prolog (http://www.visual-prolog.com/), also formerly known as PDC Prolog and Turbo Prolog. Visual Prolog is a strongly-typed object-oriented extension of Prolog, which is considerably different than standard 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.

The core of Visual Prolog are Horn Clauses like in Prolog, but opposed 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).