From 7e0e38bd155fab76fa3b6776f9184611d044903d Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sun, 18 Jul 2021 17:53:37 -0400 Subject: Finish lexical scope documentation --- docs/doc/paradigms.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/doc/paradigms.html') diff --git a/docs/doc/paradigms.html b/docs/doc/paradigms.html index 750e2302..9e2538f2 100644 --- a/docs/doc/paradigms.html +++ b/docs/doc/paradigms.html @@ -14,7 +14,7 @@

Dynamic types and garbage collection introduce overhead relative to a statically-typed or manually managed language. The impact of this overhead can be greatly reduced with array programming, because an array of numbers or characters can be stored as a single unit of memory and processed with functions specialized to its element type.

Styles

BQN is designed for array programming. The array is its only built-in collection type and it has many primitives designed to work with arrays.

-

BQN is okay for imperative programming. Blocks are lists of statements. Variables can be modified with , and while there are no truly global variables, lexical scoping allows variables at the top level of a file, which are similar (•Import with no left argument saves and reuses results, so that data can be shared between files by loading the same namespace-defining file in each). BQN doesn't directly support structured programming (which refers to a particular way to structure programs; it also doesn't have a Goto statement, the "unstructured" alternative when the term was coined). However, its first-class functions allow a reasonably similar imitation of control structures.

+

BQN is okay for imperative programming. Blocks are lists of statements. Variables can be modified with , and while there are no truly global variables, lexical scoping allows variables at the top level of a file, which are similar (•Import with no left argument saves and reuses results, so that data can be shared between files by loading the same namespace-defining file in each). BQN doesn't directly support structured programming (which refers to a particular way to structure programs; it also doesn't have a Goto statement, the "unstructured" alternative when the term was coined). However, its first-class functions allow a reasonably similar imitation of control structures.

Functional programming is a term with many meanings. Using the terms defined in the functional programming document, BQN supports first-class functions and function-level programming, allows but doesn't encourage pure functional programming, and does not support typed functional programming. BQN uses lexical scope and has full support for closures. In this way BQN is very similar to Lisp, although it lacks Lisp's macro system.

BQN has excellent support for tacit or point-free programming, with trains and intuitive symbols for combinators making it much easier to work with (in my opinion) than other languages that support this style. It's near-universally considered a poor choice to implement entire programs in a tacit style, so this paradigm is best used as a small-scale tool within a style like functional or object-oriented programming.

BQN uses namespaces as modules to organize code; the only possible interaction with a module is by its exported variables. There doesn't seem to be a name for this paradigm, but there should be.

-- cgit v1.2.3