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 20:27:48 +1100

Fergus Henderson wrote:
> 
> In logic languages which don't have if-then-else, but which do have
> cut, e.g. Lambda Prolog, you can simulate if-then-else using cut.
> But this is a hack; it's nicer if the language supports if-then-else
> directly.

No, it is the if-then-else that is the hack.  It isn't necessary, and
in fact the biggest problem with users of languages that support
if-then-else is a failure to properly think through the combinations
of else paths since the language is no help (in coping with multiple
levels of interacting negations and those deMoivre theorems that trip
up procedural programmers all the time).  Getting these else paths
right is a far bigger job than getting the true path correct which is
by comparison usually simple and straighforward.  

In a true logic language (Lambda, Visual Prolog) that underworld,
ignored by procedural languages - thus my claim that they can do only
half the job - is brought up to painful visibility forcing you to
work all this out properly at programming and testing time.

The if-then-else construct carries with it an implied and nasty bias
that the true path is what matters, and the false path is by its
optionality less important, and so gets less thought and frequently
no testing at all.  Can I use an else-then-if construct?    With an
optional if?  No!   In that ugly assymmetry lies the bias away from
usefulness in real problem-solving.

-- 
Regards,

Ron. [AU]



reply via email to

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