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)

8
votes
2answers
626 views

Can *any* program task be expressed without state?

This is a theoretical question, but after many years of programming in what I now realize is "normal" imperative technique, using C++ mainly, I've discovered this other world of functional ...
8
votes
7answers
665 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 ...
8
votes
5answers
740 views

Change my way of thinking in preparation for functional programming

When switching to a functional style of programming after coming from procedural and OOP, what things do I need to know upfront about "this new way of thinking"? How do you prepare yourself for ...
8
votes
4answers
826 views

Looking for good functional / oop / meta programming language with : [closed]

I want it will be native code generation // Able to compile with something like GHC cross-platform (win / linux) Functional and a bit object-oriented lambdas, pattern matching, tuples and other ...
8
votes
4answers
925 views

What's special about currying or partial application?

I've been reading articles on Functional programming everyday and been trying to apply some practices as much as possible. But I don't understand what is unique in currying or partial application. ...
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 ...
8
votes
4answers
1k views

Is pattern-matching against types idiomatic or poor design?

It seems like F# code often pattern matches against types. Certainly match opt with | Some val -> Something(val) | None -> Different() seems common. But from an OOP perspective, that ...
8
votes
2answers
1k views

Could we build a functional computer?

As mush as FP has done, in the end, all our programs are structured. That is, it doesn't matter how pure or functional we make a them - they are always translated to assembly, so what actually runs ...
8
votes
2answers
400 views

Applying the principles of Clean Code to functional languages

I'm currently reading Robert Martin's Clean Code. I think it's great, and when writing OO code I'm taking his lessons to heart. In particular, I think his advice to use small functions with meaningful ...
8
votes
3answers
1k views

Why can't we write nested shorthand functions in Clojure?

I tried to evaluate a Clojure expression with nested shorthand functions today, and it wouldn't let me. The expression was: (#(+ % (#(+ % (* % %)) %)) 5) ; sorry for the eye bleed The output was: ...
8
votes
3answers
3k views

Functional Programming approach for a simplified game using Scala and LWJGL

I, a Java imperative programmer, would like to understand how to generate a simple version of Space Invaders based on Functional Programming design principles (in particular Referential Transparency). ...
8
votes
2answers
450 views

What is the current state of SECD and SKI machine use and research? [closed]

I'm doing some independent research/study with a professor who's a very functional guy. The goal is to examine more of what's happening behind the scenes with functional languages than we normally ...
8
votes
2answers
938 views

What is an example of a continuation not implemented as a procedure?

An interesting discussion about the distinction between callbacks and continuations over on SO has prompted this question. By definition, a continuation is an abstract representation of the logic ...
8
votes
4answers
727 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 ...
8
votes
2answers
254 views

How to evaluate how well one knows functional programming

I've been wondering how to determine if I know functional programming. By know I mean in a Journeyman sense, not a master, but competent enough to do the work. I like languages w/ query/data shaping ...
8
votes
1answer
721 views

Are “normal order” and “call-by-name” the same thing?

I was studying the book Structure and Interpretation of Computer Programs and in section 1.1.5 The Substitution Model for Procedure Application the author explains the concepts of normal order and ...
8
votes
1answer
384 views

Better to use error monad with validation in your monadic functions, or implement your own monad with validation directly in your bind?

I'm wondering what's better design wise for usability/maintainability, and what's better as far as fitting with the community. Given the data model: type Name = String data Amount = Out | Some | ...
8
votes
2answers
419 views

Where do we put “asking the world” code when we separate computation from side effects?

According to Command-Query Separation principle, as well as Thinking in Data and DDD with Clojure presentations one should separate side effects (modifying the world) from computations and decisions, ...
8
votes
0answers
183 views

Functional Programming: efficiently handling whole world changes? [duplicate]

Imagine we're creating a multiplayer dungeon crawl (a roguelike) using FP where we emphasize pure functions and immutable data structures. We generate a dungeon composed of rooms, corridors, heroes, ...
7
votes
11answers
2k views

Is Object Oriented stuff really that important? [closed]

For years, I have been doing Algorithmic stuff, writing scalable data structures for internet search, for example Randomized Binary Search Trees for Auto Recommendation, BitMaps, Wisdom of Crowd based ...
7
votes
4answers
1k views

A programming language that does not allow IO. Haskell is not a pure language

Are there any 100% pure languages (as I describe in the Stack Overflow post) out there already and if so, could they feasibly be used to actually do stuff? i.e. do they have an implementation? I'm not ...
7
votes
3answers
457 views

Devising test of Haskell's value/reference semantics

In imperative languages, it is trivial to devise a programming test of language's use of "value semantics" or "reference semantics". One could do the following and check the value of a (where Vertex ...
7
votes
6answers
985 views

Reading SICP with F#? [closed]

I've been meaning to read the SICP book for a while, and am finally about to get around to it (now that I can read it on Kindle :) I'd like to learn a functional language, and I use C# at work so ...
7
votes
3answers
599 views

Beginning to think functionally

I've recently gotten into learning about functional programming. I've been coding in Scala most of this past year and am just now starting to fully grasp the power of a functional language. I want to ...
7
votes
2answers
439 views

What's a good math textbook to have on my desk while studying Haskell? [closed]

I just started learning Haskell and it seems like you can't get too far in the language without being comfortable ( or at least exposed ) to certain branches of mathematics. Unfortunately I have major ...
7
votes
3answers
316 views

What is the name of the functional argument in fold

In the higher order function fold/reduce what is the name, if any, of the functional argument? I am working on a monadic tabular processing library where rows are folded to produce simple analyses ...
7
votes
3answers
1k views

Should we be using functional and/or logic programming languages more?

I've programmed a bit of Haskell and Prolog as part of a couple of uni courses, but that's about it. And I've never seen it been used in industry (not that I've had much of working experience to begin ...
7
votes
3answers
584 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 ...
7
votes
1answer
715 views

What are functional languages most used for?

I wondered what functional languages are mainly used for? I've been reading about them and read about Haskell and others. Some seem to be just "academic" languages which makes little sense to me, so ...
7
votes
1answer
2k views

Why does Scala require functions to have explicit return type?

I recently began learning to program in Scala, and it's been fun so far. I really like the ability to declare functions within another function which just seems to intuitive thing to do. One pet ...
7
votes
6answers
402 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, ...
7
votes
2answers
284 views

Who first coined the term Higher Order Function and/or First Class Citizen?

I've come to understand that long before Haskell, O'Caml or LISP, higher order functions were an academic research subject and in mathematics, Schönfinkel (in 1967) and Haskell Curry (in 1968) already ...
7
votes
2answers
502 views

implement cons function in Java - type safety question

I am working on a small functional library written in Java, which mimics the a functional style of programming. I am stuck with a undesirable type cast in one of my method definitions and would love ...
7
votes
2answers
444 views

Values, types, kinds, and…?

We all know what a value is. A type is the type of a value. A kind is (loosely) the type of a type. A type constructs a value; a kind constructs a type. So what is the type of a kind, a thing that ...
7
votes
7answers
996 views

What can we learn from inactive assembly languages? [closed]

There are still groups of programmers who support old microprocessors, e.g., Z80, 6510, 68000, etc. What can we learn from old assembly languages at a time when functional programming is becoming ...
7
votes
3answers
2k views

MapReduce explained with diagrams?

I'm searching for an explanation of how MapReduce works with visuals. Specifically, a flow chart of actions and pictures of how it deals with information on the stack/memory in parallel to return. ...
7
votes
2answers
342 views

Is Haskell function composition an instance of pipe & filter architectural pattern

The pipe & filter architectural pattern is defined as a chain of processing elements, arranged so that the output of each element is the input of the next. Every example seems to consider ...
7
votes
1answer
2k views

C++11 support for higher-order list functions

Most functional programming languages (e.g. Common Lisp, Scheme / Racket, Clojure, Haskell, Scala, Ocaml, SML) support some common higher-order functions on lists, such as map, filter, takeWhile, ...
7
votes
3answers
600 views

Long parameter list versus long state variable list

In a C++ book, the author says we no longer need a function with a long parameter list because most of the parameters can be refactored into state variables in a class. On the other hand, a ...
7
votes
1answer
400 views

What are some techniques I can use to refactor Object Oriented code into Functional code?

I've spent about 20-40 hours developing part of a game using JavaScript and HTML5 canvas. When I started I had no idea what I was doing. So it started as a proof of concept and is coming along ...
7
votes
2answers
196 views

What is “Semantics visibility”?

I'm reading 97 Things Every Programmer Should Know, now I'm positioned in "Apply Functional Programming Principles", and there is a paragraph that says: ...A leading cause of defects in imperative ...
7
votes
3answers
625 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, ...
7
votes
1answer
549 views

How can we calculate Big-O complexity in Functional & Reactive Programming

I started learning functional programming, I am trying to compare between different algorithms that are written in an imperative, functional , parallel programming and using Collections and Lambda ...
7
votes
1answer
286 views

Are there any academic papers on the merits of imperative over functional programming?

There are lots of academic papers on the merits of functional programming floating around. There's also a lot of debate that I see (on the internet) going on about the relative merits of imperative ...
7
votes
2answers
320 views

Design Pattern Books, Papers or Resources for Non-Object Orientated Paradigms?

After viewing this video on InfoQ about functional design patterns I was wondering what resources are out there on design patterns for non-object orientated paradigms. There are plenty out there for ...
7
votes
0answers
229 views

Using uniqueness types to implement safe parallelism

I've been interested in uniqueness types as an alternative to monads in pure functional languages for some time; unfortunately, this is kind of an esoteric area of CS research and online resources ...
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 ...
6
votes
5answers
6k views

Is there any difference between pointers and references? [duplicate]

References and pointers do the same thing as I know. Is there any difference between them? If there is no difference, why we call them reference not pointer?
6
votes
3answers
825 views

How is referential transparency enforced?

In FP languages, calling a function with the same parameters over and over again returns the same result over and over again (i.e. referential transparency). But a function like this (pseudo-code): ...
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 ...