All Questions
Tagged with functional-programming imperative-programming
20 questions
10
votes
4
answers
1k
views
Functional architecture with lots of I/O
I'm learning about "Functional Core, Imperative Shell" as espoused by Gary Bernhardt in his talk about "Boundaries". In reality, it seems like these ideas have been known for a ...
1
vote
2
answers
351
views
What is the difference in the implementation of a monad in a purely functional language with respect in an imperative language?
For a long time, the use of these Monad structures has been restricted to a very small circle of languages, many of them purely functional (mainly due to problems related to the management of the IO). ...
12
votes
4
answers
3k
views
Why usage of assignment operator or loops discouraged in functional programming?
If my function meets the two requirements listed below, I believe that the function Sum returns the summation of the items in a list, where item evaluates as true for a given condition. Doesn't this ...
11
votes
3
answers
5k
views
Do functional programming languages disallow side effects?
According to Wikipedia, Functional programming languages, that are Declarative, they disallow side effects. Declarative programming in general, attempts to minimize or eliminate side effects.
Also, ...
4
votes
1
answer
432
views
Can heavy use of the service pattern substitute pure functions without losing benefits?
There are huge benefits to pure functions in functional programming, but can the same benefits be obtained in imperative programming with heavy use of the service pattern?
I ask because I want to ...
1
vote
0
answers
321
views
What are the types of tasks for which Functional Programming paradigm really wins over imperative one? [closed]
During its evolution C# gradually gets more and more features which belong to functional paradigm.
Subjectively these features allow (at least me) to be more productive, fluent and write maintainable ...
3
votes
2
answers
211
views
What is the most idiomatic way to iterate collection with different action for first element?
Sometimes we meet a situation where we should iterate (or map) over a collection, applying the same procedure (function) for all elements except the first one. The simplest example is finding the max ...
3
votes
3
answers
590
views
Declarative programming for deterministic real time control
Let's say you want control a motor in real time. Normally you would use a microcontroller or PC with e.g. c-programming language. So you would use an imperative approach. You tell the microcontroller ...
7
votes
2
answers
4k
views
Is declarative programming overrated? [closed]
I've been programming for years with primarily-imperative languages (C++, C#, javascript, python), but have recently experimented with some functional langauges (Lisp, Haskell) and was excited to try ...
11
votes
2
answers
2k
views
Functional programming, compared to the process of a computer [duplicate]
In functional programming, it is considered bad practice (at least from my observations) to use state changes. Since computers operate in an imperative-language-like matter (performing one operation ...
19
votes
5
answers
7k
views
What makes functional programming languages declarative as opposed to Imperative?
On many articles, describing the benefits of functional programming, I have seen functional programming languages, such as Haskell, ML, Scala or Clojure, referred to as "declarative languages" ...
3
votes
1
answer
4k
views
Advantages of the imperative style over the functional style [duplicate]
There's a lot of hype over functional languages right now, and I've spent the last year studying Haskell as my intro to FP as a result. Seeing the advantages FP provides is easy (such as referential ...
1
vote
1
answer
285
views
How do I enforce 'referential transparency' in this program?
Below is the python program written to follow the rule of thumb in functional programming.
The simple rule of thumb is: if you can replace any expression, sub-expression or subroutine call with the ...
2
votes
5
answers
3k
views
Is it possible to use functional paradigm in imperative languages?
If I understand the concept correctly the goal, which functional languages are trying to achieve is to eliminate any side effects from functions and to eliminate a state. The rationale behind this is ...
40
votes
4
answers
14k
views
What is referential transparency?
I have seen that in imperative paradigms
f(x)+f(x)
might not be the same as:
2*f(x)
But in a functional paradigm it should be the same. I have tried to implement both cases in Python and Scheme, ...