Help!  You are trying to get me to dust off that part of my brain that hasn't worked on abstract math in several years!
 
Actually, I like math, and my wife thinks me a geek because I took Calc 1 & 2 as a pre-med elective in college.  But I haven't done much in that line since, and I'm not sure I'm ready to pursue this right now.  My mental bandwidth is taxed trying to run a medical practice and (currently) get the darn pharmacy package working.
 
Having said that, I don't see the "calculus" part of lamba calculus.  I thought that 'calculus' (at least Newton's calculus) had to do with integration etc.
 
It also seems that Haskell may be a cool tool for some aspects such as data relations.  But for other parts it may require one to stand on one's head to get the job done.
 
Lets take a "Haskell VistA" example, where all of VistA is rewritten in Haskell.  Sure one can map data relationships.  But at some point I will have some job that needs to be done in an sequential fashion.  First I register a patient, then I enter a progress note.  I would find it difficult to shape this problem in my head otherwise.
 
Kevin
 

 
On 11/23/05, Gregory Woodhouse <[EMAIL PROTECTED]> wrote:

On Nov 22, 2005, at 8:28 PM, Gregory Woodhouse wrote:

> Yes, but this is imperative code. In functional languages, you
> don't "do" things, you describe them. A line of a program is not a
> command that "does" something, it's a definition of a relationship
> of some sort. In the spreadsheet example, when you say that a cell
> should contain the sum of the contents of the cells above it, you
> aren't actually adding anything, you're declaring a relationship
> that must hold between the cells in your spreadsheet.

I guess it's a little uncool of me to leave you hanging like this. If
functional programs don't "compute" but instead "describe", then how
does anything ever get done? Well, that's a really good question, and
it turns out that the mathematical foundation of functional
programming is something known as lambda calculus (invented by Alonzo
Church). The syntax of lambda calculus is almost trivial. There are
only three things: variables, applications and lambda abstractions.
If you will allow me to use the backslash (\) in place of the lower
case Greek letter lambda, then a function (f) of one variable (x) is
written like this

\x . f

That's not very interesting unless you know something about f. But
there is something you can do with lambda expressions, you can
"reduce" them. For example \x . x represents the identity function
(in conventional notation, f(x) = x), because if you "apply" it to y,
you get the "reduction"

(\x . x) y ==> y

The way you apply the abstraction \x . x to y is to replace the x
bound by \x by y, thus obtaining y. This example isn't terribly
interesting, but consider the reduction

\x . (\y . plus 1) 2 ==> \x . add-1 2 ==> 1 + 2 = 3

where I've introduced the symbol

add-1 = \x . x + 1

for the function that adds 1 to its argument.

There is no guarantee that the process of reducing an _expression_ will
ever stop (programs can go into infinite loops), but if it *does*
stop, a result known as the Church-Rosser theorem (technically, the
first Church-Rosser theorem) says the result is unique up to renaming
of bound variables (think formal parameters). An _expression_ that
cannot be reduced further is called a normal form, and functional
programs compute by reducing expressions to normal form. It turns out
that the lambda calculus is exactly as expressive as Turing machines,
or partial recursive functions, or any of other various equivalent
formulations of computability.

===
Gregory Woodhouse
[EMAIL PROTECTED]

"It is foolish to answer a question that
you do not understand."
--G. Polya ("How to Solve It")





-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Hardhats-members mailing list
Hardhats-members@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to