Chris Smith wrote: > Joachim Durchholz <[EMAIL PROTECTED]> wrote: > >>OTOH, isn't that the grail that many people have been searching for: >>programming by simply declaring the results that they want to see? > > Possibly. > >>No, FPLs are actually just that: compilable postconditions. > > This seems to me a bit misleading. Perhaps someone will explain why I > should stop thinking this way; but currently I classify statements like > this in the "well, sort of" slot of my mind. If functional programming > were really just compilable postconditions, then functional programmers > would be able to skip a good bit of stuff that they really can't. For > example, time and space complexity of code is still entirely relevant > for functional programming. I can't simply write: > > (define fib > (lambda (x) (if (< x 2) 1 (+ (fib (- x 1)) (fib (- x 2)))))) > > and expect the compiler to create an efficient algorithm for me.
This is true, but note that postconditions also need to be efficient if we are going to execute them. That is, the difference you've pointed out is not a difference between executable postconditions and functional programs. Both the inefficient functional definition of 'fib' and an efficient one are executable postconditions. In order to prove that the efficient implementation is as correct as the inefficient one, we need to prove that, treated as postconditions, the former implies the latter. (In this case a single deterministic result is required, so the former will be equivalent to the latter.) -- David Hopwood <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list