News for hackers. Stuff that matters.
Re:From Imperative to Functional: how to make the leap by grapjas on Monday February 25, 2013 @07:29AM (#5278592)
Why do you use 'λ' instead of '\'? Is this normal in haskell projects?
Re:From Imperative to Functional: how to make the leap by dkhenry on Monday February 25, 2013 @07:34AM (#5278607)
Either the author has a shiny new keyboard with a λ key, or they really really like to copy and paste.
Re:From Imperative to Functional: how to make the leap by friendly_chap on Monday February 25, 2013 @07:42AM (#5278638)
Syntax error: Either data constructor not in scope.

Perhaps you meant one of these:

   Left "the author has a shiny new keyboard with a λ key"

   Right "they really really like to copy and paste"
Re:From Imperative to Functional: how to make the leap by loup-vaillant on Monday February 25, 2013 @07:42AM (#5278636)
Shiny new keyboard: http://bepo.fr/
Re:From Imperative to Functional: how to make the leap by gruseom on Monday February 25, 2013 @04:11PM (#5281829)
Or a programmable text editor. I bind λ to S-l in emacs.
Re:From Imperative to Functional: how to make the leap by loup-vaillant on Monday February 25, 2013 @07:41AM (#5278630)
As far as I know, it isn't. I just figured that anyone who understand '\' might understand 'λ' as well. And those who don't know Haskell might just figure that 'λ' stands for 'function'.
Re:From Imperative to Functional: how to make the leap by kyllo on Monday February 25, 2013 @11:48AM (#5279869)
Lisp and Ruby, among other languages, actually use the word 'lambda' as a keyword for declaring an anonymous function. It's more typing than "\", but the intent is clear.

I don't think Haskell is really the best choice of language for demonstrating these FP concepts simply because Haskell's syntax is a little cryptic to those who haven't studied it. Lisp would have been a more readable choice since the syntax is trivial.

Also, you didn't touch on recursion, which is a key concept in FP. The idea of having a function call itself repeatedly in order to loop through a data structure, instead of iterating over the data structure by mutating a counter variable, is a huge paradigm shift for people who are new to FP.

Re:From Imperative to Functional: how to make the leap by eru on Wednesday February 27, 2013 @11:09AM (#5293035)
Yes. But in practice we almost never recurse through a data structure directly. We once recursively define a combinator to fold the datastructure, and then always use that combinator for working with the data structure.
Re:From Imperative to Functional: how to make the leap by anonymouz on Monday February 25, 2013 @08:28AM (#5278862)
But in that way your Haskell code examples seem to not be valid Haskell anymore. Seems to be a rather pointless change for the sake of simply breaking things.
Re:From Imperative to Functional: how to make the leap by loup-vaillant on Monday February 25, 2013 @11:18AM (#5279649)
Well, given this: http://news.ycombinator.com/item?id=5278883 I now believe the notation needs to be explained anyway. I'll switch back to '\'.