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 ...
1
vote
2answers
61 views
Why lift of binary function to list monads goes over all element combinations?
Say, if I want to create a cartesian product of two lists, I could do (here in Haskell, but I can do the same e.g. in Scala or any other FP-able language)
cartesianProd = liftM2 (,)
then
...
3
votes
1answer
229 views
Are there design flaws (“ugly parts”) on Haskell, that are left for historical reasons? [on hold]
Many languages have "ugly parts" that are generally agreed to be design flaws. For example, JavaScript's == operator, Common Lisps's funcall, to cite a few of many.
What are some of those design ...
2
votes
1answer
114 views
An alternative to an array of functions?
I'm programming an app (php) which requires a very long list of similar yet different functions, which are being called by a set of keys:
$functions = [
"do this" => function() {
// ...
2
votes
0answers
70 views
How is intermediate data organized in MapReduce?
From what I understand, each mapper outputs an intermediate file. The intermediate data (data contained in each intermediate file) is then sorted by key.
Then, a reducer is assigned a key by the ...
-1
votes
0answers
69 views
Node.js Empty function
Suppose I have a function defined in the following way.
function MyFunction(param, CallBack) {
// Doing stuff
CallBack();
}
I want to call the same function with three different parameters but ...
13
votes
1answer
390 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 ...
2
votes
0answers
40 views
idea mapping with global state [closed]
I need to map ideas to ideas to ideas to ideas (four in total, semantically, and a fifth one-to-one):
the state is global
it can change over time
I'm writing the module from scratch
Here's my ...
1
vote
1answer
71 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 ...
4
votes
2answers
158 views
Better way to familiarize myself with Haskell [closed]
I'm a Haskell beginner. I started learning Haskell around 20-25 days back. With a programming day job I am doing this in my spare time because I wanted to learn about functional programming.
...
1
vote
1answer
145 views
Example of a javascript app using immutable data structures? [closed]
JavaScript is functional but not in a strict sense. It does not rely on immutable data and side-effect free functions. There are a few libs that provide immutable data structures, so I believe it ...
6
votes
3answers
207 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 ...
1
vote
4answers
195 views
How should you cleanly restrict object property types and values in Python?
I have been learning python from no long time ago. But nearly at the beginning I stumbled on simple question:
how to set a restriction (limitation) on object value or object's properties without ...
-1
votes
1answer
170 views
Is there any practical algorithm / data-structure that can't be done with non-recursive Lambda Calculus augmented with foldl?
In my search for a practical non-turing complete programming language, I've been paying attention to lambda-calculus with disallowed self-application - that is, x x forbidden. After taking that ...
2
votes
3answers
193 views
Why it is `(cons 1 (cons 2 (cons 3 nil)))` and not `(cons 3 (cons 2 (cons 1 nil)))` for [1,2,3]?
Is there any special reason that to construct list in Scheme you use
(cons 1 (cons 2 (cons 3 nil)))
instead of
(cons 3 (cons 2 (cons 1 nil)))
? While the first seems more obvious because it ...
2
votes
2answers
318 views
Is there any particular reason for the use of lists over queues in functional programming languages?
Most functional programming languages such as Scheme and Haskell use lists as their main data structure. Queues are identical to lists, except for the fact appending to the end - not to the begin - ...