The imperative-programming tag has no usage guidance.
3
votes
2answers
124 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
3answers
113 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 ...
1
vote
2answers
478 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 ...
51
votes
4answers
6k views
Development process used for the code on Apollo 11 missions?
The Apollo missions had technology no more complicated than a pocket calculator.
From link here, there's an information about Apollo Guidance Computer (AGC)
The on-board Apollo Guidance Computer ...
10
votes
2answers
1k 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 ...
8
votes
5answers
1k 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" ...
2
votes
1answer
1k 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
1answer
143 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 ...
8
votes
5answers
10k views
How to structure a loop that repeats until success and handles failures
I am a self-taught programmer. I started programming about 1.5 years ago. Now I have started to have programming classes in school. We have had programming classes for 1/2 year and will have another 1/...
-1
votes
1answer
179 views
How to encourage to write pure functions in imperative environments? [closed]
In functional programming languages, a developer is always cautious about writing pure functions. Some functional languages simply do not allow impure functions, and some other functional languages ...
3
votes
2answers
209 views
Cognitive Modeling Programming vs Imperative Programming vs Declarative Programming
I'm reading this article by John Funge about Cognitive Modeling for Computer Games: http://www.qrg.northwestern.edu/resources/aigames.org/1999/fungegame99.pdf
And some further detailed reading about ...
1
vote
4answers
821 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 ...
2
votes
3answers
380 views
Inheritance in imperative programming
My first introduction to programming was Java, which was horrible so I learnt Actionscript3 which was nice... "The point is" OOP was my introduction to programming where by I went on to gain a career ...
2
votes
1answer
2k views
how to enumerate/generate all possible binary trees from N leaves and N-1 nodes?
I am trying to implement the 24 Game in ansi C. This game goes as follows:
For a list of four given numbers, try to find a solution involving these four numbers, that, using addition(+), subtraction(-...
27
votes
3answers
5k 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, ...
1
vote
1answer
423 views
Mixing declarative & imperative code (Implicit 'unit tests' ?) [closed]
Well I'm no expert, but as a student, I'm curious about languages and their design patterns / goals.
I'd like to know, whether there are any points I miss in the following examples, and why ...
10
votes
5answers
761 views
Can a pure-functional solution to this problem be as clean as the imperative?
I have an exercise in Python as follows:
a polynomial is given as a tuple of coefficients such that the powers are determined by the indexes, e.g.: (9,7,5) means 9 + 7*x + 5*x^2
write a function to ...
8
votes
1answer
7k views
Why is imperative programming preferred over functional programming? [closed]
Background: I am proponent of functional programming who works at a VB.NET shop where the prevailing mental model is imperative programming. Being that foundation of our system is WinForms I can ...
6
votes
2answers
1k views
Differences between imperative-language and functional-language debuggers
Up to now I have always worked with imperative languages like Pascal, C, C++, Java in a production environment, so I have experience with debuggers for these languages (Turbo Pascal, Turbo C, GDB / ...
5
votes
2answers
290 views
Does the structured programming definition only consider imperative programming?
Does the structured programming definition only consider imperative programming? By this I mean does the definition of structured programming automatically exclude functional programming (in the most ...
24
votes
5answers
4k views
How to make the transition to functional programming?
Lately, I have been very intrigued with F# which I have been working a bit with. Coming mostly from Java and C#, I like how concise and easily understandable it is. However, I believe that my ...
12
votes
4answers
15k views
Example of where Functional Programming is Superior to Imperative or Object-Oriented Programming? [duplicate]
Possible Duplicate:
Which problems domains are more suited to functional programming solutions
I've been reading about functional programming. I've been using mostly C#.net recently, and I ...
57
votes
3answers
21k views
What's The Difference Between Imperative, Procedural and Structured Programming?
By researching around (books, Wikipedia, similar questions on SE, etc) I came to understand that Imperative programming is one of the major programming paradigms, where you describe a series of ...