Questions tagged [declarative-programming]

Declarative programming is a paradigm of expressing the logic of a computer program or computation without explicit describing its control flow.

78 questions
1
vote
2 answers

How to make alloy run on a dataset to check all the rules

I have built an alloy program to check some rules of a system. Now I want to check the rules in the real system. For this I have all the data from the real system. For example, My alloy tool check the rules of finding the mutual friend between two…
faysal
  • 162
  • 2
  • 14
1
vote
3 answers

With React what is the best way to handle conditional classes

I have many elements on a component who needs "active" and "disabled" classes on certain conditions. for example-: 1-There i need to toggle active class on click:-
JA9
  • 1,708
  • 3
  • 14
  • 18
1
vote
1 answer

Why does the Münster compiler believe a pattern match across ++ is non-deterministic?

I recently installed the Münster Curry Compiler to replace the much slower PAKCS that I was using. The first thing I wanted to test was whether I could use some of the pattern matching features from PAKCS, because I know some implementations (Sloth…
1
vote
1 answer

Member in combination with recursion

I learn Prolog at university and keep stumbling on someting rather odd during the home excercises. I wrote following Prolog clauses, which are part of a much bigger program: edges(X,Edges):- …
1
vote
1 answer

Transform NSString to Objective-C control

I want to reproduce declarative programming like in WPF on IOS(objective-c). In WPF I could use a control like so: The exact code would…
radu florescu
  • 4,315
  • 10
  • 60
  • 92
1
vote
2 answers

Conjuction of custom constraints

I have defined some custom constraints like that: constraint(a,something). constraint(a,something1). constraint(a,something2). and i need this logical conjunction of them all as a result. ( if one constraint fails, the result should fail…
SdSdsdsd
  • 123
  • 10
1
vote
3 answers

How is Java an 'imperative' programming language and not a 'declarative' one?

Specially in comparison to C/C++ (which are declarative), how is Java imperative?
Moeb
  • 10,527
  • 31
  • 84
  • 110
0
votes
1 answer

Are object oriented languages more powerful than declarative programming languages

Are object oriented languages more powerful than declarative programming languages? By powerful I mean are they able to solve a class of problems that any program written in a declarative programming language can't? Personally I don't think so.…
user966892
0
votes
0 answers

A question about the inner workings of ASP

I'm confused about the inner workings of ASP. Say I'm modelling a country's. For example, say we have city(london). city(manchester). city(leeds). city(newcastle). city(sheffield). road(a1). road(b1). connects(a1, london,sheffield). connects(b1,…
0
votes
0 answers

Prolog exercise that has to connect a conveyor belt to an oven in a factory is not working

I want to create a Prolog program that can connect conveyor belts to ovens and an output belt. The program has the following facts: factory(12,10). oven((2,5),(4,5)).…
Student CS
  • 53
  • 6
0
votes
1 answer

SwiftUI list item not updated if model is wrapped in @State

Given a View with a simple List an ItemView for each element of the list a Model for the app a model value (Deck) Tapping on a button in the main view, is expected the model to change and propagate the changes to the ItemView. The problem is that…
jalone
  • 1,953
  • 4
  • 27
  • 46
0
votes
1 answer

Python nested currying

I was trying to solve a codewars problem here, and I got a bit stuck. I believe I should be using nested currying in Python. Let us just take the case of add. Let us constrain the problem even more, and just get nested add working on the right hand…
0
votes
2 answers

How to do a simple angular Jasmine Unit testing when using RXJS reactive approach using a subject and a stream that calls a service

How can I do a simple angular Jasmine Unit testing when using RXJS reactive approach Here is my simple implementation of the component. I have an items stream that gets some collection of items. Then I have a dropdown in HTML that calls the…
0
votes
1 answer

In this example using the reduce() internal iterator function, why won't the accumulator acknowledge this digit?

I'm kind of baffled here. I'm simply trying to use the reduce function to create a String representing the elements of a list in numbered order. Here is the code: val names = listOf("John", "Billy", "Tom", "Joe", "Eric", "Jerry") val result =…
0
votes
2 answers

Populate list of multiples using stream

Is there a way to write this method in a Java 8 declarative style, using stream()? public List getFives(int numberOfElements, int incrementNum) { List list; int value = incrementNum; list.add(value); for (int i = 0;…
user13123978