News for hackers. Stuff that matters.
Re:A practical introduction to functional programming by nbevans on Sunday January 25, 2015 @07:44PM (#8944960)
Yep. It always amazes me when die-hard OOP'ers get it all wrong and think FP is at war with their beloved OO. Well no. Plenty of FP languages exist that combine FP and OO together. Scala.. F#.. OCaml.. etc.
Re:A practical introduction to functional programming by seanmcdirmid on Sunday January 25, 2015 @07:48PM (#8944969)
It always amazes me when die-hard FP'ers get it all wrong and think OOP is at war with their beloved FP. Well no, plenty of OOP languages exist that combine FP and OO together. Scala.. C#.. Clojure.. etc.
Re:A practical introduction to functional programming by mercurial on Monday January 26, 2015 @05:53AM (#8946412)
C# at least doesn't do immutability per default, which is another classical property of FP.
Re:A practical introduction to functional programming by seanmcdirmid on Monday January 26, 2015 @06:33AM (#8946499)
Most functional programming languages don't do immutability by default (which anyways, is an aspect of the library that can choose to be or not to be; LINQ definitely is). There are also no true scotts men.
Re:A practical introduction to functional programming by mercurial on Monday January 26, 2015 @09:07AM (#8947028)
Considering there is no (AFAIK) agreed upon definition of what an FP language is, I'm using classical as "common and found in older FP languages", not saying that an FP language which isn't immutable per default is not FP.

I'm think of Haskell, OCaml or (AFAIK) Erlang. From what I read, Clojure has also a lot of emphasis on immutability.

Re:A practical introduction to functional programming by seanmcdirmid on Monday January 26, 2015 @09:14AM (#8947065)
Haskell and OCaml aren't really that old. I'm thinking ML and Lisp, scheme, which don't focus on immutability.

Both clojure and haskell have mutability, just at differing granularities (haskell monads, clojure replace the world object). They can do it with referential transparency though (which is probably your meaning, obviously pure immutability is impossible and not sensical).

Re:A practical introduction to functional programming by mercurial on Monday January 26, 2015 @10:06AM (#8947301)
Haskell is from 1990 and OCaml from 1996, it's not awfully recent.

> Both clojure and haskell have mutability, just at differing granularities (haskell monads, clojure replace the world object). They can do it with referential transparency though (which is probably your meaning, obviously pure immutability is impossible and not sensical).

Well, you have to have to be able to manipulate state somehow (even if, at least on the surface, the state monad emulates mutability, as opposed to, eg, OCaml's notion of mutation, which is very explicit in what it does). But the point is that it is not the path of least resistance in these languages.

Re:A practical introduction to functional programming by seanmcdirmid on Monday January 26, 2015 @05:23PM (#8949999)
They are not very old either, at least not compared to Lisp (60s), scheme and the MLs (70s/80s). Haskell is quite brand spanking new in comparison to the old guard.

What C# lacks for me in FP, case matching, has little to do with purity. The FP story involves purity but is not dominated by it. List comprehensions still work in C# even though you can theoretically side effect in your select and filter functions.

Re:A practical introduction to functional programming by nbevans on Monday January 26, 2015 @12:26AM (#8945641)
Perfect example ^
Re:A practical introduction to functional programming by ww520 on Monday January 26, 2015 @11:13AM (#8947738)
Did you just illustrate his point? No one in the comments mentioned OOP and you were the one to bring it up to disparage it. He was just responding to your hypocrisy.
Re:A practical introduction to functional programming by nbevans on Monday January 26, 2015 @08:00PM (#8950688)
"Bring it up to disparage it"... uh what?
Re:A practical introduction to functional programming by ww520 on Monday January 26, 2015 @11:08AM (#8947712)
You've got it wrong. OOP'ers have no problem using FP. It is die-hard FP'ers who would disparage OOP whenever given the chance.
Re:A practical introduction to functional programming by reymus on Monday January 26, 2015 @11:31AM (#8947853)
I think you're right. OOP'ers tend to not understand FP, and when they do get it, they are happy to use it. On the other hand, die-hard FP'ers tend to look down on OOP'ers.
Re:A practical introduction to functional programming by CmonDev on Tuesday January 27, 2015 @05:13AM (#8952277)
I'd bet many FP'ers don't really understand OOP either. They tend to think creating complex hierarchies is necessary and algebraic data types and modules magically fix everything.