From: Edward Faulkner Date: 2005-10-03T13:32:46+09:00 Subject: Re: Functional Programming? (was Re: Lazy evaluaton) --MGYHOYXEY6WxJCY8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Oct 02, 2005 at 05:16:45AM +0900, Jay Levitt wrote: > From reading this thread, I would have assumed that FP is another > word for "procedural" but clearly it's much, much more. Indeed, functional programming is almost the *opposite* of procedural. In a procedural program, most lines are executed for their side effects. In a functional program, most lines are executed for their value. The key idea in functional programming is that the functions you define are functions in the mathematical sense. If you call one twice with the same arguments, you'll always get the same answer each time. They have no internal state and no side effects. In practice most programs need non-functional parts too, but you can keep those isolated. By keeping your code functional, you make it easier to test and debug. It's inherently thread safe, and optimizations like lazy evaluation and memoization can be introduced transparently by the compiler/interpreter. regards, Ed --MGYHOYXEY6WxJCY8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFDQLQSnhUz11p9MSARAkZTAJ9W/GNqpDS1H8NnqpcfO1I0NxNsjACgqHXi pggv2uv0omaYY5or+/O/Awk= =IUwW -----END PGP SIGNATURE----- --MGYHOYXEY6WxJCY8--