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)

22
votes
6answers
2k views

Is functional programming a superset of object oriented?

The more functional programming I do, the more I feel like it adds an extra layer of abstraction that seems like how an onion's layer is- all encompassing of the previous layers. I don't know if this ...
5
votes
5answers
1k views

Functional programming readability

I'm curious about this because I recall before learning any functional languages, I thought them all horribly, awfully, terribly unreadable. Now that I know Haskell and f#, I find it takes a little ...
17
votes
3answers
707 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# ...
5
votes
2answers
915 views

Differences between imperative-language and functional-language debuggers

Up to now I have always worked with imperative languages like Pascal, C, C++, Java in a production environment, so I have experience with debuggers for these languages (Turbo Pascal, Turbo C, GDB / ...
37
votes
5answers
3k views

Critique of the IO monad being viewed as a state monad operating on the world

The IO monad in Haskell is often explained as a state monad where the state is the world. So a value of type IO a monad is viewed as something like worldState -> (a, worldState). Some time ago I ...
20
votes
3answers
1k views

Different ways to see a monad

While learning Haskell I have faced a lot of tutorials trying to explain what are monads and why monads are important in Haskell. Each of them used analogies so it would be easier to catch the ...
12
votes
1answer
1k views

Does Clojure have the continuation?

I started programming with Python. When using python, concepts like coroutine, closure made me really confusing. Now I think I know them some superficial level, but I want to get the "enlightement" ...
5
votes
3answers
2k views

Is it a better practice pre-initialize attributes in a class, or to add them along the way?

I'm sorry if this is a ABSOLUTELY sophomoric question, but I'm curious what the best practices are out there, and I can't seem to find a good answer on Google. In Python, I usually use an empty class ...
4
votes
4answers
624 views

How are objects modelled in a functional programming language?

In an answer to this question (written by Pete) there are some considerations about OOP versus FP. In particular, it is suggested that FP languages are not very suitable for modelling (persistent) ...
7
votes
3answers
519 views

What statements and approaches should I avoid when learning functional programming?

I have 6 years of programming experience, mostly following the object oriented paradigm, and I'm interested in learning functional programming. My main goal is to become a functional paradigm ...
4
votes
3answers
218 views

Is an Inner Function Justified in this Situation

I'm new to the functional programming concepts in C#, but I have some experience with higher order functions via Haskell, Scala, Python and Ruby. I'm currently going through an old .NET 2.0 codebase ...
34
votes
7answers
3k 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 ...
0
votes
2answers
530 views

I cannot understand the application of oops How can I develop the understanding of application of oops?

I am struggling hard to learn the application of Object Oriented Programming since last 2 years. I am a developer in PHP technology, I am aware of almost all the basics of OOPS, but still cannot find ...
1
vote
2answers
819 views

Performance of concurrent software on multicore processors [closed]

Recently I have often read that, since the trend is to build processors with multiple cores, it will be increasingly important to have programming languages that support concurrent and parallel ...
2
votes
2answers
566 views

Functional Programming, JavaScript and UI - some neophyte questions

In the discussion here, the comments in the accepted answer suggest that I approach the given code from a functional perspective, which was new to me at the time. Wikipedia said, among other things, ...
18
votes
2answers
650 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 ...
6
votes
3answers
480 views

A deque based on binary trees

This is a simple immutable deque based on binary trees. What do you think about it? Does this kind of data structure, or possibly an improvement thereof, seem useful? How could I improve it, ...
6
votes
3answers
633 views

Am I getting Scheme wrong?

Inspired by the numerous posts about the importance of learning Lisp/Scheme I started to learn Scheme two days back, I am using the book "The little Schemer" and have completed half of it. But I ...
2
votes
2answers
972 views

Equivalent of Domain Driven Design for functional programming languages

I really love the idea of domain driven design, however, as I'm learning Go, I'm wondering if there's the equivalent of DDD that's aimed at an effectively more functional language?
1
vote
2answers
358 views

How do functional languages handle a mocking situation when using Interface based design?

Typically in C# I use dependency injection to help with mocking; public void UserService { public UserService(IUserQuery userQuery, IUserCommunicator userCommunicator, IUserValidator userValidator) ...
6
votes
1answer
302 views

How Does The Maybe Monad Relate To The Option Type?

I was doing a presentation on F# and was discussing the Option type when someone in the audience asked me if the Option type is F#'s implementation of the maybe monad. I know that's not the case but ...
12
votes
4answers
697 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 ...
1
vote
2answers
156 views

What are/would be the characterists and applications of a programming paradigm where functions can't have statements?

Suppose there is a language where, instead of statements, functions could only be defined in relation to other functions and operators such as partial application and composition. What would be the ...
7
votes
6answers
1k views

Maybe monad vs exceptions

I wonder what are the advantages of Maybe monad over exceptions? It looks like Maybe is just explicit (and rather space-consuming) way of try..catch syntax. update Please note that I'm intentionally ...
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 ...
3
votes
6answers
170 views

Using “off-paradigm” coding practices in an existing codebase

Let's assume, for a second, that you're "the boss", or architect, or whatever position would permit you the authority to decide on the following question: You work on a product that's existed for a ...
11
votes
3answers
1k views

Scala or Clojure Functional Programming best practices

I did a lot of self-study coding, got some experience with Parallel Programming Models: Actors, Software Transactional Memory, Data Flow. When I am trying to apply these architectures to real life - ...
11
votes
5answers
293 views

Convert list of 24-hour-precipitation values into total-by-hour

Let's say I have a list of precipitation values by hour, each showing how much rain happened in the prior 24 hours, ordered by date. For example: { '2012-05-24 12:00': 0.5, // .5" of rain from ...
6
votes
4answers
1k views

What is the name for a NON-self-calling function?

I have a collection of normal functions and self-calling functions within a javascript file. In my comments i want to say something along the lines of "This script can contain both self-calling and ...
26
votes
2answers
2k views

Why did the Haskell committee choose monads to represent IO?

The Clean language uses uniqueness types to handle IO in a purely functional setting. Why did the Haskell committee go with monads instead? Were there other proposals for handling state that the ...
14
votes
7answers
2k views

Are functional languages better at recursion?

TL;DR : Do functional languages handle recursion better than non-functional ones? I am currently reading Code Complete 2. At some point in the book, the author warns us about recursion. He says it ...
5
votes
2answers
258 views

Does the structured programming definition only consider imperative programming?

Does the structured programming definition only consider imperative programming? By this I mean does the definition of structured programming automatically exclude functional programming (in the most ...
-2
votes
2answers
478 views

Where are functional languages used? [duplicate]

Possible Duplicate: Functional Programming in Commercial Software Which problems domains are more suited to functional programming solutions I just wonder where do functional programming ...
9
votes
6answers
665 views

Is there an infinite amount of knowledge in a programming language?

I can program in Java, C#, C, Scala, and Javascript fluently. I'm comfortable with Objective-C, but I don't remember the conventions used for memory management. I can read Python and Ruby and I've ...
8
votes
1answer
1k views

Is the Mercury Programming Language used in the field?

I've strong interests in Functional and Logic programming and Mercury seems like a good blend of the two. Is it used in industry at all? I'm one to learn a language just for the fun of it but it would ...
6
votes
2answers
224 views

Language that can statically ensure a map's fields are present

If data is simple and objects are complex, I'm curious if there are any existing statically typed languages that would be able to augment(?) a map type into a type with guaranteed fields. I realize ...
19
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 ...
7
votes
6answers
396 views

Don't structure data all the way down

In the blog post Don't structure data all the way down, the author discusses different ways to structure a circle datatype and how to implement the parameters to a Radius function. area({circle, ...
5
votes
6answers
357 views

Do non-pure interpreters still make the guarantees of functional programming?

I am assuming the implementations/compilers/generated C code (referred to hereinafter as generic, 'interpreter') for most functional programming languages are written in non-pure functional languages. ...
8
votes
7answers
655 views

How to introduce your team to functional style of coding?

I have a situation where most people in my group come from an object oriented programming background with little to no understanding of functional programming. Not even basics like closures. Any ...
18
votes
6answers
2k views

how a pure functional programming language manage without assignment statements?

When reading the famous SICP, I found the authors seem rather reluctant to introduce the assignment statement to Scheme in Chapter 3. I read the text and kind of understand why they feel so. As ...
5
votes
3answers
1k views

Learning functional programming [closed]

This question is similar to Choosing a functional programming language. I want to learn functional programming but I am having troubles choosing the right programming language. At the university I ...
2
votes
3answers
221 views

Turning your code inside out (functional style) compared to a OO paradigm

I have find this article Turning Your Code Inside Out and I want to know how this approach described in article is for OO programmers/languages. Is this style of design used in OO ...
3
votes
4answers
603 views

Introducing functional programming constructs in non-functional programming languages

This question has been going through my mind quite a lot lately and since I haven't found a convincing answer to it I would like to know if other users of this site have thought about it as well. In ...
0
votes
1answer
143 views

Syntax logic suggestions

This syntax will be used inside HTML attributes. Here are a few examples of what I have so far: <input name="a" conditions="!b, c" /> <input name="b" /> <input name="c" /> This ...
8
votes
4answers
596 views

Design in “mixed” languages: object oriented design or functional programming?

In the past few years, the languages I like to use are becoming more and more "functional". I now use languages that are a sort of "hybrid": C#, F#, Scala. I like to design my application using ...
10
votes
1answer
767 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 ...
8
votes
5answers
1k views

Data structures in functional programming

I'm currently playing with LISP (particularly Scheme and Clojure) and I'm wondering how typical data structures are dealt with in functional programming languages. For example, let's say I would like ...
2
votes
4answers
801 views

Resources for learning common algorithms by Lisp [closed]

Many books about algorithms and data structures are coded by imperative languages. Is there any book that can show functional programming languages can do the same thing or do them better? In ...
4
votes
3answers
559 views

How to write functionally in a web framework

I love Rich Hickey, Clojure and Haskell and I get it when he talks about functions and the unreliability of side-effecting code. However I work in an environment where nearly all the functions I ...