Skip to main content

Questions tagged [functional-programming]

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 isolated.

Filter by
Sorted by
Tagged with
1 vote
1 answer
222 views

I'm learning Domain-Driven Design (DDD) and studying different architecture patterns, and I’ve come across two seemingly conflicting design philosophies around domain modeling. 1. Rich Domain Model ...
Penchala Yegu's user avatar
4 votes
3 answers
314 views

Not long ago while I was exploring for solutions to test without mocks I've found out about the functional core, imperative shell architecture. It sounds great, I also think that it would play nicely ...
 sentientbottleofwine's user avatar
4 votes
5 answers
499 views

I'm working on an application and have encountered two different approaches for organizing business logic. There's a general consensus that application rules should be handled in higher layers, so I ...
Azuos's user avatar
  • 49
3 votes
3 answers
353 views

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
4 votes
2 answers
446 views

(this question is written using javascript for examples) Say I have a bunch of files that I need to access sequentially: 1.json 2.json 3.json 4.json ... Say I want to transform the data in all of ...
rpivovar's user avatar
  • 263
2 votes
1 answer
332 views

The Decorator pattern allows behaviour to be dynamically added to an existing object, effectively "decorating" it with new behaviour. While the pattern as formalised and named seems to have ...
Iain Galloway's user avatar
2 votes
1 answer
155 views

Consider a processing system which ingests objects from an external source and performs extensive processing. One example could be objects detected by a computer vision system which are then fed into ...
panlex's user avatar
  • 265
6 votes
2 answers
1k views

While I was learning functional programming I have encounterd two for me very similar terms: immutability and persistence. Also I have read simular questions from stackoverflow, but I am still ...
DimitrijeCiric's user avatar
-1 votes
1 answer
136 views

The Kotlin language brings the simplification of function calls to the natural language. This article shows a nice example: Function: fun of(suit: Suit) = Card(this, suit) val card = Rank.QUEEN.of(...
Nikolas's user avatar
  • 613
1 vote
3 answers
2k views

I have recently read about the so-called "distributed enum anti-pattern." In particular, as it relates to using enums in conditional statements. (The idea is apparently that if you were to ...
user1713450's user avatar
0 votes
2 answers
546 views

.NET Boolean type usually makes if else pair all over the code. Functional Boolean should be more like Either type. Ideally represented as Either<Unit, Unit>. However, my issues with Either type ...
TIKSN's user avatar
  • 109
7 votes
1 answer
536 views

I am reading through "Clean Architecture: A Craftsman's Guide to Software Structure and Design" and it says that: All race conditions, deadlock conditions, and concurrent update problems are ...
Quantum Guy 123's user avatar
18 votes
5 answers
6k views

By definition, a pure function is deterministic + no side effect. Is there any example for a function which has no side effects, but is non-deterministic? I.e., a function without side effects, but ...
Helin Wang's user avatar
5 votes
2 answers
508 views

I am working on a compilers assignment in OCaml, and the following is an example of the pre-written code in said assignment: (* Build a CFG and collection of global variable definitions from a stream *...
SRSR333's user avatar
  • 335
2 votes
2 answers
390 views

I often come across this dilemma in my own code and wondered if there is a term for this and if there is a single solution to it. Let me illustrate it with a pseudocode example of making a table from ...
deSKase's user avatar
  • 139
1 vote
2 answers
517 views

I don't know from where I got this but in my head a function returns a value and a method does not. I know that with OOP a method is a function related to a class. But I am trying to remember where I ...
houimli manel's user avatar
4 votes
2 answers
1k views

When trying to follow a functional programming paradigm, I often find myself in a situation where I have a chain of functions that I would want to combine/compose somehow, but they all also take in a ...
Cordello's user avatar
  • 423
0 votes
2 answers
504 views

I'm new to DDD and I would like to clarify some concepts. I'm thinking about DDD in the client-side. The first one is regarding transactions: My understanding is that transactions are a responsibility ...
João Otero's user avatar
1 vote
2 answers
221 views

I have one large class that computes ~50 different metrics (each metric has no side effects). My code is similar to this: class ReportingMetrics: def __init__(self, data:pd.DataFrame, config:dict)...
MYK's user avatar
  • 343
0 votes
1 answer
1k views

In Python, consider a function like the following: def main(*args): value1 = pure_function1(*args) if condition(value1): value = side_effect1(value1) if value: ...
pob's user avatar
  • 109
0 votes
2 answers
151 views

I am working on an algorithm that optimizes utilitization of a vehicle. What I have is a list of paths the vehicle is planned to take and between which times (time windows) it has to be at a certain ...
Blaž Mrak's user avatar
1 vote
2 answers
265 views

I am trying to find a good way of allowing two objects that are separated by a intermediate object to communicate while keeping the architecture loosely coupled. A solution I have developed is to pass ...
dda2120's user avatar
  • 21
1 vote
3 answers
145 views

I'm searching for any formal/generic approach to modeling a process distributed in time with functional programming. Here is an example. Let's implement a very simple notification service. It accepts ...
Anthony's user avatar
  • 149
-1 votes
1 answer
108 views

I need to create a program with the purpose of cross-referencing personal info from a spreadsheet(s), to check for conflicts of interest between clients of 3 different law firms. All of this client ...
boog's user avatar
  • 99
9 votes
2 answers
5k views

I'm interested in becoming more familiar with functional programming as a paradigm, so I'm trying to introduce a more functional style to some of my projects. I'm struggling to understand how to ...
Hassan's user avatar
  • 345

1
2 3 4 5
15