users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: if


From: Ron Stodden
Subject: Re: if
Date: Tue, 30 Jan 2001 05:41:27 +1100

Eduardo Damasio da Costa wrote:
> 
> I am new to prolog and I am surprised apparently there is no "if" predicate.

In a pure sense, that is true.   There is no need for an if construct
because Prolog is a logical language, and every statement is logical
- meaning it can, for a particular set of passed values, either
succeed or fail.

If it fails, then no solution is to be found in this direction and
the system automatically abandons that, wipes out all the results so
far, and backtracks to the last decision point and tries the next
alternative, if any.   This is how it searches for and finds
solutions to a given problem.  Uncannily like life.   

This is also why learning a logical language, although patently much
simpler and better, is a traumatic experience for people used to
today's crop of mainstream "jack-in-the-box"-type imperative
not-well-designed languages.   You have to unlearn a great deal <g>.

-- 
Regards,

Ron. [AU]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]