Declarative programming: Difference between revisions

Content deleted Content added
Tag: Reverted
AnomieBOT (talk | contribs)
m Dating maintenance tags: {{Cn}}
Tag: Reverted
Line 21:
These definitions overlap substantially.
 
Declarative programming is a non-imperative style of programming in which programs describe their desired results without explicitly listing commands or steps that must be performed. Functional and logic programming languages are characterized by a declarative programming style. In logic programming, programs consist of sentences expressed in logical form, and computation uses those sentences to solve problems, which are also expressed in logical form.{{cn|date=July 2025}}
 
In a [[pure functional language]], such as [[Haskell (programming language)|Haskell]], all functions are [[pure function|without side effects]], and state changes are only represented as functions that transform the state, which is explicitly represented as a [[First-class citizen|first-class]] object in the program. Although pure functional languages are non-imperative, they often provide a facility for describing the effect of a function as a series of steps. Other functional languages, such as [[Lisp (programming language)|Lisp]], [[OCaml]] and [[Erlang (programming language)|Erlang]], support a mixture of procedural and functional programming.{{cn|date=July 2025}}
 
Some logic programming languages, such as [[Prolog]], and database query languages, such as SQL, while declarative in principle, also support a procedural style of programming.{{cn|date=July 2025}}
 
==Subparadigms==