G


Intro       Symbols A B C D E F G H I J K L M N O P Q R S T U V W X Y Z       Index  
generator [Class]

Identical to an algorithm except that it saves the objects it computes. Generators are created using the generator macro. A generator is useful for saving different versions of algorithmic output or for computing material that is intended to be further processed or edited.

See Also:

algorithm, heap, merge, mute, thread, Describing Music Algorithmically

 


generator name type ({slot value}*) {form}* [Macro]

Defines a generator object. Macro syntax is otherwise identical to that of algorithm.

See Also:

algorithm, Describing Music Algorithmically, generator [Class]

 


graph [Pattern]

Enumerates items according to transition links associated with each item. Items are represented by nodes in the graph. Each node is specified as a list:

({item} {option value}+)

item is the item to return from the node. Following item comes one or more options value pairs:

id {datum}
Sets datum to be the unique identifier for the node in the pattern. The identifier may be any Lisp object as long as its uniquely represented in the pattern. If omitted, the identifier defaults to item but is safest to provide each node with an explicit id.
to {id | stream}
Sets the transition link for the graph node. This option is required for each node. The value may be a single identifier or an item stream of identifiers.
props {value}
Associates value with the graph node. Since value is never examined by the system it is only useful when specifying an alternative selection function.
The first node in the graph's data becomes the first node visited in the pattern. Subsequent nodes are visited by applying the graph's selection function to the current node to produce the id of the next node in the pattern. The default selection function works by reading the to field of the current node to produce the id of the next node in the pattern.

graph implements the following option value pairs:

with {function}
Sets the graph selection function. The function is passed two arguments, the current node and the stream object, and should return the id of the next node in the pattern.
previous {integer | ({id}+)}
Presets the number of previous node ids to pass to the selection function when implementing Markov selection.

Example:

? (setf x (items (a to (items a b c in random))
                 (b to (items a c in cycle))
                 (c to a)
                 in graph))
#<GRAPH-ITEM-STREAM 135506031>

? (read-items x 15)
(A C A A B A B C A B A A C A C)

See Also:

Item Streams, markov.cm