News for hackers. Stuff that matters.
Re:Ask HN: Functional Programming Differences by unignorant on Sunday March 07, 2010 @03:31PM (#1173946)
You might include something more explicit about function composition (e.g. the power of currying).

Closures might be another thing to mention. For instance, you could show how they can be used to implement objects (which should be familiar to C# people).

Re:Ask HN: Functional Programming Differences by eru on Sunday March 07, 2010 @03:46PM (#1173973)
Composability in general is a major attraction of functional languages. Haskell has an especially strong focus on it.
Re:Ask HN: Functional Programming Differences by DanielBMarkham on Sunday March 07, 2010 @03:47PM (#1173976)
I'm torn on closures and currying/composition.

Great concepts, sure. But in an hour? Might be too much to get their heads around.

One of my code samples is going to be lifted from this great blog entry: http://diditwith.net/2008/03/14/WhyILoveFARefactoringTale.as... where he basically covers some of these concepts by way of example.

I think no matter how I do it, it's going to look (to them) like some hand-waving and magic. Can't really help that, I don't think.

Re:Ask HN: Functional Programming Differences by evgen on Sunday March 07, 2010 @10:28PM (#1174576)
If you are going to go any distance into the functions as first-class citizens path then it might not be too much of a diversion to show a function that generates functions and then bounce quickly to simple currying as a more advanced example of this. You would not even need to describe it as currying..
Re:Ask HN: Functional Programming Differences by loup-vaillant on Monday March 08, 2010 @03:35AM (#1174997)
Plus, first class functions can be shown with mere high school mathematics. Lambda are really easy: the

    f: R  -> R
       x |-> blah(x)
you find in high school would be

    f : (float -> float)
      = fun x  -> blah x
In Ocaml (and probably F#).

The composition operator can easily be seen as a function with two arguments, which show "first class" functions:

    o : (R->R), (R->R)  -> (R  -> R      )
        (f    , g    ) |-> (x |-> f(g(x)))
And poof, you can introduce currying:

    o : ((R->R), (R->R) , R)  -> R
        (f     , g      , x) |-> f(g(x)))