┌────────────────────────────────────┐ │ "Declarative languages, │ │ have no notion of execution state, │ │ nor of the passing of time." │ └────────────────────────────────────┘ Functional programming of which (nicely written) D-functions are an example, derives from the slightly more abstract notion of declarative programming. http://www.foldoc.org gives the following definition for "Declarative Language": "A general term for a relational language or a functional language, as opposed to an imperative language. Imperative (or procedural) languages specify explic- it sequences of steps to follow to produce a result, while declarative languag- es describe relationships between variables in terms of functions or inference rules and the language executor (interpreter or compiler) applies some fixed algorithm to these relations to produce a result. The most common examples of declarative languages are logic programming languages such as Prolog and funct- ional languages like Haskell." The scripts in this workspace can be seen as programs in such a language. From a background in procedural languages such as C or traditional APL, it might seem surprising that for example, an algorithm for long division could be written us- ing only equations. The algorithm needs no variables (in the procedural sense of the word, as nothing varies) and has no procedural control structures, such as loops or conditional execution (see: Long_division). In this context,the term "pattern variable" used in these scripts to declare a set of pattern-matching values, is a misnomer. Perhaps "pattern set" would be more appropriate. Here is (one view of) a partial taxonomy of computer languages: Language ┌─────────────────┴───────────────────────┐ Declarative Procedural ┌────────┴─────────────────────┬───────┬─··· ┌────┴────┬────··· Functional Logic ? C Trad_APL ┌───┴───┬────┬────┬─··· ┌────┴─··· │ Haskell D min max Prolog eval_script See also: dfns.dws/notes.pearly Back to: →Contents←