Declarative programming is a paradigm of expressing the logic of a computer program or computation without explicit describing its control flow.
Questions tagged [declarative]
365 questions
9
votes
1 answer
Declarative SQLAlchemy CREATE SQLITE in memory tables
This is how I setup my database for an application (in Flask):
from sqlalchemy.engine import create_engine
from sqlalchemy.orm import scoped_session, create_session
from sqlalchemy.ext.declarative import declarative_base
engine = None
db_session =…

Radek
- 3,913
- 3
- 42
- 37
9
votes
5 answers
Why is Haskell fully declarative?
I'm not very good in understanding the difference between the imperative and declarative programming paradigms. I read about Haskell being a declarative language. To an extend I would says yes but there is a something that bothers me in respect to…

xetra11
- 7,671
- 14
- 84
- 159
9
votes
1 answer
Combining __table_args__ with constraints from mixin classes in SQLAlchemy
In SQLAlchemy, I have read on how to combine the __table_args__ from different mixins when declaring a declarative.
Combining Table/Mapper Arguments from Multiple Mixins
The question I had is, the example shows how this is done at the end of the…

Thomas Farvour
- 1,103
- 2
- 11
- 24
9
votes
1 answer
A common pattern involving composition of functions (\a b -> f (g a) (g b))
The composition of f and g that looks like
f :. g = \a b -> f (g a) (g b)
is a pattern I find very often in my code. It is similar to unary function composition, only f is binary and I want g applied to both arguments before they are passed to…

kqr
- 14,791
- 3
- 41
- 72
9
votes
2 answers
SQLAlchemy declarative property from join (single attribute, not whole object)
I wish to create a mapped attribute of an object which is populated from another table.
Using the SQLAlchemy documentation example, I wish to make a user_name field exist on the Address class such that it can be both easily queried and easily…

Cory Dolphin
- 2,650
- 1
- 20
- 30
8
votes
2 answers
Declarative GTK
TL;DR: Is there a library for declarative UI creation using GTK? Preferrably with Python support.
I'm a Python/Django developer, most of my experience about user interfaces is from the web, where declarative, loosely coupled UI designs are…

Danilo Bargen
- 18,626
- 15
- 91
- 127
8
votes
6 answers
"Turning" an IEnumerable> 90 degrees
What I'm looking for is a basic operation (Which I'm sure have a name I'm just unaware of atm). I have a matrix like:
{1,2,3}
{A,N,F}
{7,8,9}
which I'd like to mutate into
{1,A,7}
{2,N,8}
{3,F,9}
(The above are only identifiers for objects not real…

Rune FS
- 21,497
- 7
- 62
- 96
8
votes
2 answers
Jenkins declarative pipeline: What workspace is associated with a stage when the agent is set only for the pipeline?
Here is an example of declarative pipeline where the agent is set for the pipeline but not set in the individual stages:
pipeline {
agent { node { label 'linux' } }
stages {
stage('Checkout') {
steps {
…

user1171968
- 167
- 2
- 6
8
votes
2 answers
In SQLAlchemy, how do I define an event to fire DDL using declarative syntax?
This example shows how to use it with "non-declarative" - http://docs.sqlalchemy.org/en/latest/core/ddl.html#sqlalchemy.schema.DDL
How can I use it with the ORM declarative syntax?
For example, with this structure:
Base =…

Richard Green
- 2,037
- 2
- 20
- 38
7
votes
3 answers
Declarative validation of forms in Java/Swing
I use Java for client-side development with Swing. I love Swing; I believe it is one of the better GUI frameworks there. What I miss, however, is the support for declarative validation. Like this snippet from XForms.
Do you know any library which…

Alexander Temerev
- 2,654
- 3
- 27
- 34
7
votes
2 answers
Declarative Function Naming
How can functions be named to clearly reflect that they follow a declarative paradigm?
Context: I've recently started working on creating libraries that work in a declarative manner but I'm having a hard time coming up with a naming convention…

Mr. Llama
- 20,202
- 2
- 62
- 115
7
votes
2 answers
How to choose in runtime among several OSGi services in an intelligent way?
I've in mind an intelligent system which can choose among available OSGi services dynamically. That is, choose an implementation or another depending of some runtime parameter. For example, notify to a running algorithm that change an operator after…

Pablo García
- 237
- 1
- 10
7
votes
4 answers
ASP.NET masterpages: how to insert markup in the head section inside the aspx?
I know I can access the head section of a page which uses a masterpage programmatically this way (in code behind):
This is only an example (I'd like to insert scripts and styles etc.):
this.Header.Title = "I just set the page's title";
Is there a…

splattne
- 102,760
- 52
- 202
- 249
7
votes
2 answers
How to override a Jenkinsfile library function locally?
I have a standardized declarative Jenkinsfile used in many projects. I have moved the entire pipeline into a library, so my Jenkinsfile looks like this:
@Library('default_jenkins_libs') _
default_pipeline();
The library…

Mike Rysanek
- 177
- 2
- 7
7
votes
2 answers
How to convert if else to fully declarative in Prolog?
It's one of my classroom question.
I was able to create my own Prolog program with bunch of if-else but I was told that my program is not fully declarative as its one of the very foundation principle in Prolog.
Here's my code
%start with :-…

J.Doe
- 1,097
- 1
- 16
- 34