It follows the form of the mathematical set-builder notation (set comprehension) as distinct from the use of map and filter functions.
The SETL programming language (1969) has a set formation construct which is similar to list comprehensions.
E.g., this code prints all prime numbers from 2 to N: The computer algebra system AXIOM (1973) has a similar construct that processes streams.
The first use of the term "comprehension" for such constructs was in Rod Burstall and John Darlington's description of their functional programming language NPL from 1977.
The language was first order, strongly (but not polymorphically) typed, purely functional, call-by-value.
An exception was Turner's influential, pure, lazy, functional programming language Miranda, released in 1985.
The Python language introduces syntax for set comprehensions starting in version 2.7.
[4] In XQuery, full XPath is available, but FLWOR statements are also used, which is a more powerful comprehension construct.
So, in another functional language the above FLWOR statement may be implemented like this: C# 3.0 has a group of related features called LINQ, which defines a set of query operators for manipulating object enumerations.
This allows, amongst other things, for the IQueryable to C++ does not have any language features directly supporting list comprehensions but operator overloading (e.g., overloading |, >>, >>=) has been used successfully to provide expressive syntax for "embedded" query domain-specific languages (DSL).
Alternatively, list comprehensions can be constructed using the erase-remove idiom to select elements in a container and the STL algorithm for_each to transform them.
XPath's // separator that "skips" intermediate nodes in the tree is implemented in LEESA using what's known as Strategic Programming.