Skip to main content

All Questions

0 votes
3 answers
235 views

How to filter "locally and remotely" in functional programming

My example applies to reading and deleting files (I/O), but this is probably a common scenario (eg, keeping local and global state in sync in functional programming). I am reading in files from a ...
rpivovar's user avatar
  • 263
3 votes
3 answers
304 views

How to "pass through" data in a functional programming pipeline so that it's accessible later on in the pipeline

I am trying to refactor some JavaScript code to use functional programming principles. I have some functions that I want to use in a series of maps. const transformedData = rawData .map(...
rpivovar's user avatar
  • 263
5 votes
3 answers
616 views

Are "pipelines" in functional programming bad for time complexity?

This question is not meant to be a critique of functional programming, but more hoping for resources and opinions. I am refactoring some historically messy code so that it follows functional ...
rpivovar's user avatar
  • 263
1 vote
2 answers
325 views

Why did TC39 name JavaScript's array predicate functions `some` and `every` instead of `any` and `all`?

Python, Ruby, Rust, Haskell, Kotlin, C#, C++, Perl, MATLAB, SQL, and R all call their respective array predicate checking functions any and all. Is there any record of why JavaScript's designers ...
Alex Ryan's user avatar
  • 127
0 votes
2 answers
759 views

Should I use unnecessary function for readability sake

I am implementing if/else statement, by using function "inCase" to make it more readable: const size = 'small' const equals = str1 => str2 => str2 === str1 const inCase = (obj) => ...
Djordje Vuckovic's user avatar
4 votes
3 answers
963 views

Is this extensive usage of closure a known (anti-)pattern? And does it have a name?

I often use function closures for storing data (e.g. database URL), which doesn't change between function calls. Is this an (anti-)pattern? Does it have a name? While developing apps, which recieve ...
Sebastian DonnerWolfBach's user avatar
16 votes
10 answers
7k views

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 ...
releseabe's user avatar
  • 539
12 votes
2 answers
5k views

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 ...
Qiulang 邱朗's user avatar
1 vote
4 answers
471 views

In Haskell, is it a "violation" of functional programming to interact with something that was not a function parameter?

I'm sure this must have been asked before, but I can't find anywhere that actually answers my question, so apologies if I have simply overlooked this. I am currently learning Haskell, and loving the ...
Raiden616's user avatar
  • 141
3 votes
1 answer
1k views

How do functional programming advocates use a framework like React or Angular?

I read this blog post recently: The Two Pillars of JavaScript Part 1: How to Escape the 7th Circle of Hell, which is essentially a criticism of object oriented programming, and advocacy for funtional ...
dwjohnston's user avatar
  • 2,687
0 votes
1 answer
177 views

Is the usage of flip function a smell for bad design?

Everything is in the title, is the usage of flip function a smell for bad design ? I'm coming from a JavaScript universe and used to work with lodash/fp or ramda. Recently, I've written some stuff ...
mfrachet's user avatar
  • 1,561
1 vote
0 answers
563 views

Understanding transducers, why this is not a transducer

I'm currently learning functional programming and trying to learn a new concept : transducers. I'm actually getting the point of theory, like it's an advanced map/reduce that aims to provide better ...
mfrachet's user avatar
  • 1,561
10 votes
1 answer
796 views

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 ...
thadeuszlay's user avatar
4 votes
2 answers
484 views

What are the correct functional programming terms for what I'm doing here?

I recently needed a function to deep clone an object. I started with the code given as an accepted answer to this question: https://stackoverflow.com/a/728694/1253156 However, our SonarQube ...
Patrick Hund's user avatar
9 votes
2 answers
791 views

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 ...
Andrew Willems's user avatar

15 30 50 per page