145 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
2
answers
113
views
Multiple Assignements in a Coq Map to the same value
I'm given the following definition of com that sssigns new values to more than one variable in a single command.:
Inductive com : Type :=
| CSkip
| CAsgn (xs : list string) (es : list aexp) (* <...
1
vote
1
answer
182
views
Is cobol declarative language or its is imperative
while COBOL does support some declarative programming constructs, it is primarily an imperative programming language that is designed to provide low-level control over the machine, and its main focus ...
0
votes
2
answers
661
views
How to edit reactive form from an observable data in angular imperatively without subscribing to the Observable?
Below is the process I've been using to subscribe and then update a reactive form based on observable data.
Maybe there's a way to fix the problem without subscribing to the observable and changing ...
2
votes
2
answers
162
views
Functional evaluation of conditionals in C#?
In functional programming a statement like if (a || b) can be evaluated in parallel by default, since we don't make any assumptions about the evaluation order due to referential transparency. Is there ...
3
votes
1
answer
2k
views
What is the difference between declarative and imperative programming in flutter?
Recently, I was searching for a way to enhance navigating between screens in my Flutter apps. and I found new programming concepts for me (declarative and imperative programming). I need to know more ...
0
votes
1
answer
210
views
Functional vs imperative (statements): writing this in the most compact way
Looking for the shortest, most elegant wat to write this. I really like option 2. However, i get this error:
Argument of type 'boolean[]' is not assignable to parameter of type 'SetStateAction<...
1
vote
1
answer
612
views
Incrementing a counter with functional programming vs imperative programming
I likely am asking a very stupid question here, please forgive me.
I am a Java and C# backend-engineer with relatively good knowledge of OOP design patterns. I have recently discovered the debate ...
1
vote
2
answers
91
views
sort a singly linked list formed of 1, 2 and 0s by swapping the nodes through one traversal in C
I'm trying to solve the question that I need to sort a given linked list which values consist of 1, 2 and 0 by traversing the list only once and I need to swap the nodes not values.
my code is:
#...
user avatar
user16643263
-1
votes
1
answer
637
views
OCaml loops: imperative vs recursion [closed]
I just stumbled upon some OCaml code that writes a loop like this:
let r = ref (f 0) in
for i = 1 to k - 1 do
r := f i * !r
done ;
!r
in
Which is interesting as I normally see ...
3
votes
1
answer
199
views
Updating an outer variable in Haskell
There is a sense in which Haskell is a purely functional language, and certainly, idiomatic code tries to be as functional as reasonably possible. At the same time, Haskell does provide support for ...
1
vote
1
answer
181
views
gotoxy in game condign with C
I am currently developing a Duck Hunt-style game with C language for a university class, but I'm having a problem that I can't move the player's aim while keeping the targets moving, for some reason, ...
2
votes
2
answers
2k
views
Functional programming: Declarative vs imperative
Functional programming insists on telling what to do, rather than how to do.
For example,Scala's collections library has methods like filter, map etc. These methods enable developers to get rid of ...
0
votes
2
answers
68
views
Why do I get a type unit when I want to concatenate the element of the array with an empty list?
I am trying to make a list out of a given array and in my code it returns an empty list.
I want to know why this is impossible to do with list. Is it because we are supposed to return something in the ...
1
vote
1
answer
73
views
Functional approach to storing element counts in Map
I came across a problem where I needed to count the number of Strings in an Iterable and store the sums in a Map. I came up with the following imperative solution:
private static Map<String, ...
0
votes
1
answer
832
views
How can I generate imperative non-OOP python code from UML/SysML model?
I want to generate python code based on UML/SysML. The coding is mainly imperative - calling functions that deliver results, switch states and some main part.
How can I create some simple main program,...