Functional programming is a paradigm which attempts to solve computational problems by the chained evaluation of functions whose output is determined by their inputs rather than the programme state. In this style of programming, side effects and mutable data are deprecated and usually strictly ...

learn more… | top users | synonyms (1)

70
votes
6answers
10k views

Functional Programming vs. OOP

I've heard a lot of talk about using functional languages such as Haskell as of late. What are some of the big differences, pros and cons of functional programming vs. object-oriented programming?
38
votes
7answers
4k views

Are small amounts of functional programming understandable by non-FP people?

Case: I'm working at a company, writing an application in Python that is handling a lot of data in arrays. I'm the only developer of this program at the moment, but it will probably be ...
25
votes
6answers
9k views

Choosing a functional programming language [closed]

I have read a lot of threads about functional programming languages lately (almost in the past year, in fact). I would really like to pick one and learn it thoroughly. Last [course] semester, I have ...
43
votes
12answers
7k views

Why isn't functional programming more popular in the industry? Does it catch on now? [closed]

During my four years at university we have been using much functional programming in several functional programming languages. But I have also used much object oriented programming to, and in fact I ...
27
votes
7answers
2k views

Why Functional Programming

What is the deal with functional programming? I see talk about it a lot but to be honest I've never found them at all useful. Why do so many universities apparently teach them?
19
votes
5answers
4k views

For what common problems is functional programming not a good fit? [closed]

Functional programming is a declarative paradigm. One of the strenghts with FP is that side-effects are avoided. It's said that for some problems FP isn't a good fit. For what common problems isn't ...
4
votes
1answer
1k views

Which problems domains are more suited to functional programming solutions

Which problems domains are more suited to functional programming solutions and why? Can anyone provide any examples? EDIT Just to clarify, I'm not asking for a list of problems. I want to know what ...
34
votes
5answers
8k views

Where are all the functional programming design patterns?

OO programming literature is full of design patterns. Most books on object oriented programming dedicate a chapter or two to design patterns like factories and decorators. So what are the equivalent ...
32
votes
7answers
7k views

Is Functional Programming possible in Java?

I was browsing through the Amazon.com Bookstore and I came across the book "Functional Programming for Java Developers". I know some very basic Functional Programming and have been programming in ...
35
votes
7answers
5k views

Functional Programming on the rise?

I have noticed lately that functional programming languages are gaining popularity. I recently noticed how the Tiobe Index shows an increase in their popularity in comparison to the last year although ...
21
votes
5answers
2k views

How to make the transition to functional programming?

Lately, I have been very intrigued with F# which I have been working a bit with. Coming mostly from Java and C#, I like how concise and easily understandable it is. However, I believe that my ...
26
votes
6answers
3k views

Does learning a functional language make a better OOP programmer? [closed]

As a Java/C#/C++ programmer I hear a lot of talk about functional languages, but have never found a need to learn one. I've also heard that the higher level of thinking introduced in functional ...
11
votes
4answers
934 views

Functional Programming in Commercial Software

I was recently discussing functional programming with a co-worker. While the two of us both agreed that FP has some obvious benefits (simpler code, easier to reason about mathematically, etc.), we ...
8
votes
5answers
602 views

In functional programming how does one achieve modularity through mathematical laws?

I read in this question that functional programmers tend to use mathematical proofs to ensure that their program is working correctly. This sounds alot easier and faster than unit testing, but coming ...
6
votes
3answers
1k views

Why functional programming? [duplicate]

Possible Duplicate: Why Functional Programming Hi, I'm new to functional programming. What isn't clear is: In what scenarios could functional programming be used? One thing I understand ...
19
votes
3answers
2k views

How is dependency inversion related to higher order functions?

Today I've just seen this article which described the relevance of SOLID principle in F# development- F# and Design principles – SOLID And while addressing the last one - "Dependency inversion ...
9
votes
9answers
1k views

Resources for improving your comprehension of recursion? [closed]

I know what recursion is (when a patten reoccurs within itself, typically a function that calls itself on one of its lines, after a breakout conditional... right?), and I can understand recursive ...
42
votes
14answers
3k views

Why the current enthusiasm for Functional Programming? [closed]

I've been hearing a lot of enthusiasm about functional programming languages lately, with regards to Scala, Clojure, and F#. I've recently started studying Haskell, to learn the FP paradigm. I love ...
58
votes
11answers
5k views

“Everything is a Map”, am I doing this right?

I watched Stuart Sierra's talk "Thinking In Data" and took one of the ideas from it as a design principle in this game I'm making. The difference is he's working in Clojure and I'm working in ...
30
votes
2answers
2k views

What did Alan Kay mean by “assignment” in The Early History of Smalltalk?

I have been reading The Early History of Smalltalk and there are a few mentions of "assignment" which make me question my understanding of its meaning: Though OOP came from many motivations, two ...
18
votes
5answers
4k views

Is objected oriented programming paradigm outdated since it is anti-modular and anti-parallel? [closed]

I have read the controversial article Teaching FP to freshmen posted by Robert Harper who is a professor in CMU. He claimed that CMU would no longer teach object oriented programming in the ...
16
votes
3answers
2k views

Is there a canonical tutorial or book on functional programming concepts? [closed]

Coming from a procedural/OO programming background, I tend to write Scheme programs in a procedural fashion. I would be intersted in learning Scheme or Lisp in a functional way from the ground up, to ...
23
votes
7answers
10k views

What is a “side effect?”

I haven’t clearly understood the concept of side effect. What is side effect in programming? Is it programming language dependent? Is there such a thing as external and internal side effects? ...
28
votes
12answers
3k views

Is Haskell's type system an obstacle to understanding functional programming?

I'm studying Haskell for the purpose of understanding functional programming, with the expectation that I'll apply the insight that I gain in other languages (Groovy, Python, JavaScript mainly.) I ...
20
votes
3answers
2k views

Workaround for Java checked exceptions

I appreciate a lot the new Java 8 features about lambdas and default methods interfaces. Yet, I still get bored with checked exceptions. For instance, if I just want to list all the visible fields of ...
11
votes
4answers
992 views

Functional Programming — Immutability

I am trying to understand dealing with immutable data in FP (specifically in F#, but other FP’s are ok as well) and break the old habit of state-full thinking (OOP style). A part of the selected ...
8
votes
5answers
1k views

Can functional programming be used to develop a full enterprise application?

I am just beginning to learn Functional programming (FP). I come from a OOP world, where everything are objects, and most of them are mutable. I have a hard time wrapping around the concept that ...
14
votes
4answers
2k views

Functional Programming: right ideas about concurrency and state?

FP proponents have claimed that concurrency is easy because their paradigm avoids mutable state. I don't get it. Imagine we're creating a multiplayer dungeon crawl (a roguelike) using FP where we ...
13
votes
4answers
837 views

Does groovy call partial application 'currying'?

Groovy has a concept that it calls 'currying'. Here's an example from their wiki: def divide = { a, b -> a / b } def halver = divide.rcurry(2) assert halver(8) == 4 My understanding of what's ...
18
votes
3answers
610 views

Are there any empirical studies on the effect of different languages on software quality?

The proponents of functional programming languages assert that functional programming makes it easier to reason about code. Those in favor of statically typed languages say that their compilers catch ...
12
votes
8answers
1k views

Mental Models or Real-World-Metaphors for Functional Programming

Does anyone have a good mental model or metaphor for functional programming which references something in the real world? Object Oriented programing intuitively makes sense to me. There are things ...
11
votes
5answers
2k views

Why is reading from memory not a side-effect but reading from a file is?

What does exactly make reading from the process memory a pure operation? Suppose I created an array of 100 integers in the global memory and then took the 42th element of this array. It is not a side ...
2
votes
1answer
124 views

Modeling objects as functions

I want to model simple objects as functions, to see where the pure functional approach gets me. Let's say my object is a person. There is some function that returns me a new person, but instead of ...
10
votes
3answers
1k views

How to write manageable code with functional programming?

I just started with functional programming (with JavaScript and Node.js) and from the look of things it looks as if the code I am writing would grow to be one hell of a code base to manage, when ...
5
votes
2answers
738 views

Functional programming: Writing a small interpreter

I'm working on a small Unix shell, and am contemplating the idea of writing a script interpreter. While reading about the subject I inevitably hear of functional programming, lambda calculus, and find ...
96
votes
14answers
41k views

What is the advantage of currying?

I just learned about currying, and while I think I understand the concept, I'm not seeing any big advantage in using it. As a trivial example I use a function that adds two values (written in ML). ...
33
votes
6answers
12k views

Haskell AND Lisp vs. Haskell OR Lisp

I currently code with C, C++, and Python. I'm wanting to pick up a functional programming language, and right now I'm leaning toward Haskell. I do NOT want to start a "Haskell vs Lisp" war here; what ...
37
votes
12answers
4k views

What programming language generates fewest hard-to-find bugs? [closed]

What language, in your opinion, allows the average programmer to output features with the least amount of hard-to-find bugs? This is of course, a very broad question, and I'm interested in very broad ...
26
votes
1answer
2k views

Why is an anemic domain model considered bad in C#/OOP, but very important in F#/FP?

In a blog post on F# for fun and profit, it says: In a functional design, it is very important to separate behavior from data. The data types are simple and "dumb". And then separately, you ...
20
votes
11answers
4k views

If we can do functional programming with Python, do we need a specific functional programming language? [closed]

Using generators and lambda, we can do functional programming with Python. You can also achieve the same thing with Ruby. So the question is: why do we need specific functional programming languages ...
24
votes
5answers
2k views

Does immutability entirely eliminate the need for locks in multi-processor programming?

Part 1 Clearly Immutability minimizes the need for locks in multi-processor programming, but does it eliminate that need, or are there instances where immutability alone is not enough? It seems to ...
11
votes
4answers
978 views

FP and OO orthogonal?

I have heard this time and again and I am trying to understand and validate the idea that FP and OO are orthogonal. First of all, what does it mean for 2 concepts to be orthogonal ? FP encourages ...
25
votes
1answer
625 views

Performance of single-assignment ADT oriented code on modern CPUs

Working in immutable data with single assignments has the obvious effect of requiring more memory, one would presume, because you're constantly creating new values (though compilers under the covers ...
21
votes
3answers
9k views

Haskell vs Erlang for web services

I am looking to start an experimental project using a functional language and am trying to decide beween Erlang and Haskell, and both have some points that I really like. I like Haskell's strong ...
12
votes
1answer
506 views

Disadvantages of functional intermediate form

I'm writing an optimizer for a language similar to JavaScript, and need to choose an intermediate code representation. The obvious/typical choice these days is Static Single Assignment (SSA). ...
10
votes
3answers
704 views

how to advance into higher level functional programming

first my apologies if this isn't the right place for this question but I think that th.CS is not the right place for sure neither is StackOverflow. I really like functional programming and I think ...
20
votes
4answers
2k views

How do purely functional languages handle modularity?

I come from an object oriented background where I've learned that classes are or at least can be used to make a layer of abstraction that allows for easy recycling of code which can then either be ...
10
votes
1answer
978 views

UI patterns in functional languages

I would like to start fiddling with ClojureScript, but I am puzzled about some points. My problem is what is a good way to deal with state changes coming from user interaction, when you trying to work ...
19
votes
3answers
980 views

Why is the rec keyword needed in F#?

In F# it is necessary to use the rec keyword. In Haskell there is no need to explicitly tell if a given function is recursive or not. Given the role of recursion in functional programming, the F# ...
17
votes
2answers
783 views

What are the typical applications of Lisp macros?

I am trying to learn some LISP and I have read a lot about the importance of LISP macros so I would like to get some working experience with them. Can you suggest a practical application area that ...