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
658 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
2answers
535 views

Uses of persistent data structures in non-functional languages

Languages that are purely functional or near-purely functional benefit from persistent data structures because they are immutable and fit well with the stateless style of functional programming. But ...
8
votes
2answers
187 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 ...
8
votes
2answers
250 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
280 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
4answers
592 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
0answers
174 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
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
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 ...
7
votes
2answers
590 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 ...
7
votes
3answers
328 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
3answers
565 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
6answers
842 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
2answers
412 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
2answers
838 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 ...
7
votes
3answers
968 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
516 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
3answers
286 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
1answer
608 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
6answers
395 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
256 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
440 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
7answers
894 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
3answers
551 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
2answers
904 views

Does reflection in Java make its functions “first class”

I am always hearing people talk about how Java does not support first class functions, that it is an advantage you get from functional languages, the only way to simulate it in Java is through the use ...
7
votes
1answer
342 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
1answer
262 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
299 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 ...
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
6answers
3k views

Which self balancing binary tree would you recommend?

I'm learning Haskell and as an exercise I'm making binary trees. Having made a regular binary tree, I want to adapt it to be self balancing. So: Which is most efficient? Which is easiest to ...
6
votes
3answers
618 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 ...
6
votes
2answers
944 views

Is Haskell/Clojure actually unsuited for dynamic systems such as particle simulation?

I've been told in previous questions that functional programming languages are unsuited for dynamic systems such as a physics engine, mainly because it's costly to mutate objects. How realistic is ...
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 ...
6
votes
3answers
253 views

Side Effects Breaking Referential Transparency

Functional Programming in Scala explains a side effect’s impact on breaking referential transparency: side effect, which implies some violation of referential transparency. I’ve read part of ...
6
votes
3answers
387 views

Functional Methods on Collections

I'm learning Scala and am a little bewildered by all the methods (higher-order functions) available on the collections. Which ones produce more results than the original collection, which ones ...
6
votes
1answer
1k 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 ...
6
votes
5answers
688 views

Help me deal with higher level languages [closed]

I'm trying to learn Scala (I have previously glanced at Erlang, Haskell, Ruby and had similar issues). I do enjoy it, but I feel bad about some things it does and I wonder if that's just due to all ...
6
votes
1answer
392 views

How to refactor a Java singleton to Clojure?

I'm writing a simple game in Java and I want to learn Clojure, so I've decided to refactor my current Java code to Clojure. The problem is that I've coded so much in object-oriented languages that I ...
6
votes
2answers
538 views

How do people get rid of conditional branches in Functional Programming?

Long running switch cases or if-else-if constructs are avoided in OOP using polymorphism wherever it is applicable. instead of branching by matching a value, branching is done at class-level itself. ...
6
votes
1answer
791 views

Is Rebol a functional programming language?

I ran into Rebol and I was wondering about it. I ran into the following script from here: use [feed questions answers][ feed: load-xml/dom http://stackoverflow.com/feeds/tag/rebol ...
6
votes
1answer
401 views

What is needed to implement a usable functional language

I've done some programming in a more-or-less functional style, but I've never really studied pure functional programming. What is the bare minimum needed to implement a functional language? As far ...
6
votes
2answers
240 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 ...
6
votes
2answers
319 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 ...
6
votes
2answers
411 views

Researching the growth of functional languages

In recent years it seems that functional programming languages have had a real popularity increase. Languages like Erlang, Haskell, Scala, F# and Clojure seem to be pretty well known and many popular ...
6
votes
1answer
297 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 ...
6
votes
2answers
223 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 ...
6
votes
3answers
356 views

choosing a functional language platform for a new project [closed]

I have been writing code for a few years now and I don't believe I can claim to have a complete knowledge in this job yet. My experience primarily rolls around C# related areas with a decent ...
6
votes
3answers
473 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, ...