Re: Declarative constraints in practical terms

From: x <>
Date: Mon, 27 Feb 2006 17:09:34 +0200
Message-ID: <dtv4nf$di7$>

"x" <> wrote in message news:dtv3n7$oi8$

> There are people that say this:

> max([M],M).
> max([H|T],M):-max(T,M),H<M.
> max([H|T],H):-max(T,N), H>=N.

> is more declarative than this:

> max([],M,M).
> max([H|T],M,R):-H<M, max(T,M,R).
> max([H|T],M,R):-H>=M, max(T,H,R).

We can also say the above statements are imperative statements because they state requirements :-)
By this logic we could say that the languages who are not imperative are the ones with optional statements. :-)
In other words one can delete all the statements and the program still do what it was supposed to do. :-) Received on Mon Feb 27 2006 - 16:09:34 CET

Original text of this message