# Re: Simple recursive functions in Lisp

*From*: Harald Hanche-Olsen <hanche@xxxxxxxxxxxx>*Date*: Thu, 08 Feb 2007 18:27:54 +0100

+ "Harold Lee" <harold3@xxxxxxxxx>:

| You can prove the correctness of a recursive program more easily.

I don't think it's any harder to prove a well-written iterative

algorithm correct than the corresponding recursion. In either case

it's typically a case of finding the proper invariant and then proving

that it is in fact invariant, and that it implies the the desired exit

condition at termination.

Spaghetti code can of course be hard to prove correct, even if it is.

Maybe the functional style makes it harder to write spaghetti code,

and if so that could be the reason it is claimed to be more easily

proved correct.

--

* Harald Hanche-Olsen <URL:http://www.math.ntnu.no/~hanche/>

- It is undesirable to believe a proposition

when there is no ground whatsoever for supposing it is true.

-- Bertrand Russell

.

**Follow-Ups**:**Re: Simple recursive functions in Lisp***From:*John Thingstad

**References**:**Simple recursive functions in Lisp***From:*S. Robert James

**Re: Simple recursive functions in Lisp***From:*Kaz Kylheku

**Re: Simple recursive functions in Lisp***From:*S. Robert James

**Re: Simple recursive functions in Lisp***From:*Harold Lee

- Prev by Date:
**Re: Critique of prime factorization in Lisp** - Next by Date:
**Re: Critique of prime factorization in Lisp** - Previous by thread:
**Re: Simple recursive functions in Lisp** - Next by thread:
**Re: Simple recursive functions in Lisp** - Index(es):