USER-CNSTR
Arguments: const exp &optional c-imp varmap choicemap [generic-function]
User defined constraint. 'Const' is a predicate and 'exp' is a list specifying those chords the predicate constraints.
'exp' is of the form: (range1 (choice1) range2 (choice2)....rangeN (choiceN)), where 'range' is the set of chord indexes delimiting the region in which the constraint will be applied, and 'choice' is either: s a constraint applying to subsequences in the region, f a constraint for the fixed set of chords given in the region a a constraint applying to all [[combinations]] of chords in the region.
Each of the above can be followed (optionally) by the symbol 'i'. In this case
the predicate in Const should have twice as much arguments as chords it constraints. The
extra arguments (which go all before the arguments refering to chords) represent the
indexes (i.e. chord number) of each chord in the constraint. The symbol 'i' is thus
used to allow constraints that must know not only the chords they test but also their numbers.
For instance,
the predicate in Const should have twice as much arguments as chords it constraints. The
extra arguments (which go all before the arguments refering to chords) represent the
indexes (i.e. chord number) of each chord in the constraint. The symbol 'i' is thus
used to allow constraints that must know not only the chords they test but also their numbers.
For instance,
(0_10 (s)) means that 'Const' should be applied to all subsequences in the region from
chords 0 to 10. The length of each subsequence is given by the number of arguments of 'Const'. If 'Const'
is a two argument predicate, for instance, then it will be applied to the following pairs of chords
is a two argument predicate, for instance, then it will be applied to the following pairs of chords
(0,1), (1,2),(2,3)...(9,10).
On the other hand, (1_7s2 (s i)) means that 'const' should be applied to subsequences of chords 1,3,5,7.
The 'i' in (s i) means that in this case 'const' should contain the indexes as arguments. for example
The 'i' in (s i) means that in this case 'const' should contain the indexes as arguments. for example
(defun const (i j ch1 ch2) (= (abs (- i j)) (abs (- (first ch1) (first (ch2)))))),
which makes the horizontal interval between the base notes of chords equal to the difference of
their position in the sequence.
their position in the sequence.
's' can also be followed by an integer specifying the increment for constructing the subsequences. For
example, (0_10 (s 2)) and a predicate of two arguments apply 'Const' to each one of the pairs:
(0,1),(2,3),(4,5),...(8,9).
(0,1),(2,3),(4,5),...(8,9).