Topic: sequence generators

topics > computer science > data > Group: sequences

control file
file input/output
I/O streams
index sequence for array access
infinite sequences
pattern matching
quantified repetition
random number generation
set construction


A sequence generator is a function, co-routine, or process which generates a sequence. By generating components, it can represent an unbounded sequence. Generators are used for input streams, and in iterators such as 'for x:=gen(y)'. Output streams are sequence generators for other processes. The 'CAR' operator in LISP generates elements from a list. A set specifier, such as all sub-strings of S, may define a sequence generator. For instance, a file-name pattern can indicate a sequence of file-names for processing. If the values of a sequence generator are saved (e.g., from a for loop) the result is a set or list. New sequence generators can be formed from previous generators by a linear combination (a longer sequence), a parallel combination (a sequence of pairs), or cross product combination (as sequence of all possible pairs). A parametric function forms array results from a cross product combination of argument value sequences. (cbb 5/80)
Subtopic: returning arrays for each value up

Quote: no practical problems for parametric operations which return an array of values for each value of parameters [»georJ12_1977]

Subtopic: file sets up

Quote: in Unix, many command arguments are file patterns which create a sorted list of matching filenames [»mashJR_1976]

Subtopic: enumerator up

Quote: a sequence expression is also a generator that produces elements when 'pulsed'; car and cdr are forms of pulsing a list [»wileDS11_1973]
Quote: Smalltalk provides simple generators to iterate the elements of a set [»deutLP8_1981]

Subtopic: examples up

QuoteRef: earlJ4_1974 ;;35 have set and sequence formers (eg .forAll x .memberOf. x .select. x=1
QuoteRef: earlJ4_1974 ;;36 combine sequences by sequence, cross-product or parallel
QuoteRef: earlJ4_1974 ;;37 lots of iterators (produce stream of values or a set) and iterative operators (act on streams of values eg for all)
QuoteRef: grisRE4_1979 ;;22 "Another string operation that is a generator is find (s1,s2), which returns the locations at which s1 appears as a substring of s2.
QuoteRef: morrJH8_1972 ;;758 a for loop generates a sequence which can either be saved or ignored determined by whether or not bracketing of the for loop.
Quote: a negative subscript, i, applied to a list returns a list with the first i elements removed [»morrJH_1980, OK]

Subtopic: error handling up

QuoteRef: reynJC_1965 ;;427 failure of a generator is propagated up until a conditional jump is reached

Subtopic: implementation up

Quote: if a procedure suspends execution instead of returning, it can be reactivated later; allows implementation of generators [»grisRE4_1979]
Quote: an Icon generator tries alternatives until the entire statement succeeds; gives example [»grisRE4_1979, OK]
Quote: unlike SNOBOL4, Icon allows matching procedures in the form of a generator; returns a value when 'suspend' is done [»grisRE4_1980]
Quote: the Icon scanning operation, upto©, is a generator that returns values until the expression succeeds [»grisRE4_1980]
Quote: an Icon generator is an operation that returns alternative values when the first value fails

Related Topics up

Topic: co-routines (13 items)
Topic: control file (10 items)
Topic: file input/output (21 items)
Topic: I/O streams (17 items)
Topic: index sequence for array access (16 items)
Topic: infinite sequences (7 items)
Topic: iterator (13 items)
Topic: pattern matching (42 items)
Topic: quantified repetition (11 items)
Topic: random number generation (29 items)
Topic: set construction
(20 items)

Updated barberCB 1/05
Copyright © 2002-2008 by C. Bradford Barber. All rights reserved.
Thesa is a trademark of C. Bradford Barber.