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
7
votes
4 answers
Solving Tower of Hanoi declaratively (Prolog)
My professor gave this as an example of Prolog. It is a program that solves the Tower of Hanoi puzzle, where you have to move a stack of disks to another peg by moving one disk after the other, without putting a bigger disk on top of a smaller disk.…

Bart Louwers
- 873
- 9
- 28
7
votes
3 answers
SQLAlchemy introspection of declarative classes
I'm writing a small sqlalchemy shim to export data from a MySQL database with some lightweight data transformations—mostly changing field names. My current script works fine but requires me to essentially describe my model twice—once in the class…

Seamus Campbell
- 17,816
- 3
- 52
- 60
7
votes
3 answers
how to access parent component scope from a child components scope in ember?
I'm curious if this is even possible in ember. This is an easy thing to do in angular ( plunkr: http://plnkr.co/edit/O2e0ukyXdKMs4FcgKGmX?p=preview ):
The goal is to make an easy to use, generic, reusable accordion api for api consumers.
The api I…

davidjnelson
- 1,111
- 12
- 22
7
votes
1 answer
how is java annotation represented in java bytecode
I tried to decompile a .class file that contains JUnit tests.
I read the byte code, but I did not see any clue of the @Test annotation(it's used in the java source code).
As metadata, how are annotations represented in bytecode?

Cui Pengfei 崔鹏飞
- 8,017
- 6
- 46
- 87
7
votes
2 answers
SQLAlchemy column_property basics
I have two models:
class Report(Base):
__tablename__ = 'report'
id = Column(Integer, primary_key=True)
class ReportPhoto(Base):
__tablename__ = 'report_photo'
id = Column(Integer, primary_key=True)
report_id = Column(Integer,…

drnextgis
- 2,194
- 1
- 25
- 32
6
votes
3 answers
Get last inserted value from MySQL using SQLAlchemy
I've just run across a fairly vexing problem, and after testing I have found that NONE of the available answers are sufficient.
I have seen various suggestions but none seem to be able to return the last inserted value for an auto_increment field…

PlaidFan
- 797
- 11
- 20
6
votes
1 answer
mixing foldr with OR in Haskell (laziness?)
How can this function return true?
foldr (||) False [True,undefined]
=> True
The first fold looks like this:
undefined || True
, which should return an error
So im guessing haskell gives priority to the lazyness of the OR function over doing…

pepe22
- 85
- 3
6
votes
1 answer
Passing Jenkins environment variable in Powershell script
i would like to use a jenkins environment variable inside a power shell script.Here ${destination} is coming as null inside powershell script.Not able to identify what is the mistake i am doing.Please help
# !/bin/groovy
pipeline {
agent {
…

Ramprasad
- 61
- 1
- 1
- 3
6
votes
1 answer
Processing pandas data in declarative style
I have a pandas dataframe of vehicle co-ordinates (from multiple vehicles on multiple days). For each vehicle and for each day, I do two things: either apply an algorithm to it, or filter it out of the dataset completely if it doesn't satisfy…

mchristos
- 1,487
- 1
- 9
- 24
6
votes
4 answers
What declarative language is good at analysis of tree-like data?
I'm thinking about developing a system to perform highly parallel queries on nested (but tree-like) data. The potential users are data analysts (physicists, specifically), not programmers. For the user interface, I want to use a well-known query…

Jim Pivarski
- 5,568
- 2
- 35
- 47
6
votes
3 answers
How to stop recursing?
Advent of Code Day 1 requires looping, in one form or another, over a long string of parentheses like ((((())(())(((()))(( etc. The idea is that ( goes up one "floor", ) goes down one floor, and the objectives are to print
the first index in the…

cat
- 3,888
- 5
- 32
- 61
6
votes
4 answers
What are the advantages of attribute based programming?
I am working with WCF RIA services and have come across a sample using attributes:
[StringLength(10, ErrorMessage="Too long")]
public string FirstName { get; set; }
...
While attributes aren't restricted to WCF RIA, it reminded me of a question:…

Scott Davies
- 3,665
- 6
- 31
- 39
6
votes
1 answer
Problem implementing declarative transactions
I want to implement transaction control at the function level. What i want is something like this.
class MyService{
static transactional = false
@Transactional(readOnly = false,
propagation =
Propagation.REQUIRES_NEW)
public def saveCountry(){…

imran
- 61
- 1
6
votes
5 answers
Decide(in Haskell) if a number is or not a palindrome without using lists
I need to check in Haskell if a four digit number is a palindrome, the problem is that I can't use lists, and in spite of having a fixed digit number, I should use recursion. I have been think on the problem and I couldn't get a solution using…

Iván Rodríguez Torres
- 4,293
- 3
- 31
- 47
6
votes
2 answers
implement a simple C like language in Prolog?
I'm new to prolog, so this's quite a challenge to me.
I'm supposed to implement a simple C like language in Prolog.
the ultimate goal is to be able to execute something like this:
?-…

Hashbug
- 127
- 8