Questions tagged [imperative]

Imperative programming is a paradigm of expressing the logic of a computer program or computation by explicitly describing its control flow in terms of statements that change a program state.

57 questions
4
votes
1 answer

Writing a haskell program for computing denotational semantics of an imperative programming language

I am trying to write a program in Haskell to compute the denotational semantics of an imperative language program with integer variables, 1-dimensional (integer) arrays and functions. The function I am starting with is of the type: progsem ::…
Justin B
  • 110
  • 1
  • 8
3
votes
4 answers

Sieve of Eratosthenes Scheme

I've been searching the web for an implementation of the Sieve of Eratosthenes in scheme and although I came up with a lot of content, none of them seemed to have made it like I need it to be done. The problem is most algorithms either use a static…
WiseOlMan
  • 926
  • 2
  • 11
  • 26
3
votes
1 answer

Quarkus reactive vs quarkus imperative does it matter?

Hello I was reading the following article Quarkus reactive architecture At the start of the article it says Quarkus is reactive. It’s even more than this: Quarkus unifies reactive and imperative programming. You don’t even have to choose: you can…
user19906023
3
votes
2 answers

Java v Scala from a concurrency viewpoint

I am kicking off my final year project right now. I am going to be investigating the concurrency approaches from java and scala perspectives. Having come out of a java concurrency module, I can see why people say that the shared state threading…
3
votes
2 answers

What is the difference between imperative and object-oriented programming?

When I look at numerous websites. Some use object-oriented programming and imperative programming interchangeably whilst others say that they are different. I would like to know what is the difference between object-oriented and imperative and how…
attachPost
  • 75
  • 1
  • 1
  • 10
3
votes
2 answers

Sorting an array Imperative ocaml

I'm doing a rather easy example to learn how to use ocaml as an imperative language. My guess is I messed up with the semicolons but I can't find any mistakes in the code let sort array = for index = 0 to (Array.length array -1) do let boole =…
Álvaro
  • 105
  • 1
  • 9
3
votes
0 answers

Relation between object

For a few weeks I’ve been thinking about relation between objects – not especially OOP’s objects. For instance in C++, we’re used to representing that by layering pointers or container of pointers in the structure that needs an access to the other…
phaazon
  • 1,972
  • 15
  • 21
3
votes
2 answers

Performance related to "imperative" algorithms in haskell

I have some training in the lisp family of languages and I am now learning a bit of Haskell for my own good. In lisp, functional style is ok but there are a few cases where imperative style is necessary to get decent performance, e.g. append Append…
2
votes
1 answer

Quarkus Mutiny multithreading

I have some imperative code which processes on 20 Threads in parallel. IntStream.range(0, 20) .forEach(t -> { Runnable runnable = () -> { int records = RANGE; while (records > 0) { records =…
2
votes
0 answers

Imperative Triggers in Azure Functions?

I've read many posts re how to use Imperative input and output bindings - I get that, very cool. However, what I have struggled to find is a way to create Imperative Triggers. I'm not sure if this is possible at this point. What I would like to…
Jim Speaker
  • 1,303
  • 10
  • 28
2
votes
1 answer

Make Haskell Imperative

Note: this is an exercise, and I'm trying to understand how things work. I am trying to make it possible to do something like this in Haskell: f :: Integer -> Integer f n = def $ do i <- var n while i (>0) $ do i -= lit 1 return…
arryn
  • 329
  • 2
  • 9
2
votes
1 answer

sscanf for formatting string from file

As part of a homework assignment I need to load a file with data in the following format: R1 Fre 17/07/2015 18.00 FCN - SDR 0 - 2 3.211 R1 Lor 18/07/2015 16.00 FCM - VFF 2 - 0 7.232 For doing so I used…
asdasd
  • 59
  • 6
2
votes
1 answer

Function returning type unit instead of type ref

Here I am attempting to use an imperative style factorial function, but despite the last line of the function declaring a ref to be returned, fsc is telling me that the function is returning a unit. I know mutables are not allowed to be returned,…
GuitarGuy365
  • 177
  • 1
  • 6
2
votes
1 answer

Completely lost in trying to mutate property in sequence

I am completely at loss why this code doesn't mutate a member variable in a sequence of types: for p in prescrs do p.ATC <- "A" for c in p.Drug.Components do for s in c.Substances do s.DoseTotal.Adjust <- adjustKg …
halcwb
  • 1,480
  • 1
  • 13
  • 26
2
votes
1 answer

Writing a Haskell program for typechecking programs written in an imperative programming language

I am trying to write a program in Haskell to type check programs written in an imperative programming language. Here is the abstract syntax: type Name = String -- a program is a series (list) of variable declarations and a series (list) of…
Justin B
  • 110
  • 1
  • 8