Re: Declarative constraints in practical terms

From: x <x_at_not-exists.org>
Date: Mon, 27 Feb 2006 17:09:34 +0200
Message-ID: <dtv4nf$di7$1_at_emma.aioe.org>


"x" <x_at_not-exists.org> wrote in message news:dtv3n7$oi8$1_at_emma.aioe.org...

> 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