ComputerScientist
174 subscribers
14 photos
3 files
206 links
▜ The Inventor

Stuff that inspire you to create.

See also: ▙ @LitMind
Download Telegram
#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.
“Programming languages should be designed not by piling feature on top of feature, but by removing the weaknesses and restrictions that make additional features appear necessary.”
— R5RS, #Scheme
Impromptu
- is an environment for live coding. It is built around #Scheme.

First appeared: 2005

Temporal recursion
Looping is performed by "temporal recursion", i.e. by having a function asynchronously schedule a future call to itself as its final action.

Though syntactically Scheme-like, it is semantically closer to #C, and is designed for real-time sound synthesis and other computationally heavy tasks. A programmer/performer can create and schedule code for future execution, as well as data events such as notes and graphics objects. It allows audio synthesis and video composition. It is compiled to machine language by #LLVM.