All Questions
Tagged with javascriptfunctional-programming
50 questions
111votes
3answers
16kviews
Why do Trampolines work?
I've been doing some functional JavaScript. I had thought that Tail-Call Optimization had been implemented, but as it turns out I was wrong. Thus, I've had to teach myself Trampolining. After a bit of ...
36votes
5answers
34kviews
Is Javascript a Functional Programming Language
Is Javascript a functional language? I know it has objects & you can do OOP with it also, but is it also a functional language, can it be used in that way? You know how OOP became/seems like the ...
31votes
5answers
33kviews
Performance: recursion vs. iteration in Javascript
I have read recently some articles (e.g. http://dailyjs.com/2012/09/14/functional-programming/) about the functional aspects of Javascript and the relationship between Scheme and Javascript (the ...
26votes
1answer
4kviews
Are generator functions valid in functional programming?
The questions are: Do generators break the functional programming paradigm? Why or why not? If yes, can generators be used in functional programming and how? Consider the following: function * ...
23votes
5answers
4kviews
What is the benefit of having "no runtime errors", like Elm claims?
Some languages claim to have "no runtime errors" as a clear advantage over other languages that has them. I am confused on the matter. Runtime error is just a tool, as far as I know, and ...
16votes
10answers
7kviews
Are immutable objects important only in multi-threaded applications and if so, how are shared immutable objects useful?
I think the answer to the first part of my question is, "yes" -- no point in making objects immutable in a single-threaded application (or I guess in a multi-threaded application if that ...
15votes
3answers
4kviews
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 ...
13votes
5answers
1kviews
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 programming,...
12votes
2answers
5kviews
A real-life example of using curry function? [closed]
I was struggled to find a real-life example of using curry function and get the benefit of using curry. When I google curry function I often see the example like let add = x => y => x + y; let ...
12votes
2answers
1kviews
Functional reactive programming — is Fay expressive enough?
So I'm doing a fairly involved javascript/html client with lots of ajax calls and other involvements of callback-ism. I'm entertaining the thought of using Fay for this purpose. I'm aware of Elm. ...
11votes
5answers
3kviews
Compute if a function is pure
As per Wikipedia: In computer programming, a function may be described as pure if both these statements about the function hold: The function always evaluates the same result value given the same ...
10votes
1answer
796views
Why most anonymous functions can't be JIT compiled and will never be optimized?
I just read https://techfindings.one/archives/2652 about functional programming and came accross this: anonymous functions can often not be JIT compiled and will never be optimized Can someone ...
9votes
3answers
3kviews
Is a function getting a value from another function considered pure?
I'm trying to figure out a way to handle default variable values when making functions without side effects and have ended up with the following: function getDefaultSeparator() { return ':'; } ...
9votes
2answers
791views
How can I _read_ functional JavaScript code?
I believe I have learned some/many/most of the basic concepts underlying functional programming in JavaScript. However, I have trouble specifically reading functional code, even code I've written, and ...
6votes
3answers
2kviews
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 ...