#Programming_paradigms : Declarative versus Imperative
#Declarative
All about relations.
Does not state the order in which operations execute.
Focuses on what the program should accomplish without specifying how the program should achieve the result.
Expresses the logic of a computation without describing its control flow.
Common declarative languages include those of database query languages (e.g. #SQL, #XQuery), regular expressions (#Regex), logic programming, functional programming, and configuration management systems.
e.g. #Haskell, #Kanren (a dialect of #Scheme), #Prolog, #Wolfram_Language
#Imperative
Uses statements that change a program's state.
1. they state the order in which operations occur, with constructs that explicitly control that order
Allows side effects, in which state can be modified within one unit of code, and then read inside a different unit of code.
Imperative programming focuses on describing how a program operates.
an imperative program consists of commands for the computer to perform.
Many imperative programming languages (such as #Fortran, #BASIC, and #C) are abstractions of assembly language.
#Declarative
All about relations.
Does not state the order in which operations execute.
Focuses on what the program should accomplish without specifying how the program should achieve the result.
Expresses the logic of a computation without describing its control flow.
Common declarative languages include those of database query languages (e.g. #SQL, #XQuery), regular expressions (#Regex), logic programming, functional programming, and configuration management systems.
e.g. #Haskell, #Kanren (a dialect of #Scheme), #Prolog, #Wolfram_Language
#Imperative
Uses statements that change a program's state.
1. they state the order in which operations occur, with constructs that explicitly control that order
Allows side effects, in which state can be modified within one unit of code, and then read inside a different unit of code.
Imperative programming focuses on describing how a program operates.
an imperative program consists of commands for the computer to perform.
Many imperative programming languages (such as #Fortran, #BASIC, and #C) are abstractions of assembly language.
#Programming_paradigms : #Logic programming
Based on formal logic.
Any program is a set of sentences in logical form, expressing facts and rules about some problem domain.
Major logic programming language families include #Prolog, Answer set programming (#ASP) and #Datalog.
In all of these languages, rules are written in the form of clauses:
Facts are rules that have no body.
Based on formal logic.
Any program is a set of sentences in logical form, expressing facts and rules about some problem domain.
Major logic programming language families include #Prolog, Answer set programming (#ASP) and #Datalog.
In all of these languages, rules are written in the form of clauses:
H if B1 and … and Bn.H is called the head of the rule and B1, …, Bn is called the body.Facts are rules that have no body.
Symbolic programming
- is a paradigm that describes programs able to manipulate formulas and program components as data. Programs can thus effectively modify themselves, and appear to "learn", making them suited for applications such as artificial intelligence, expert systems, natural-language processing and computer games. Languages that support this paradigm include #Lisp and #Prolog.
- is a paradigm that describes programs able to manipulate formulas and program components as data. Programs can thus effectively modify themselves, and appear to "learn", making them suited for applications such as artificial intelligence, expert systems, natural-language processing and computer games. Languages that support this paradigm include #Lisp and #Prolog.