#title Example 1: The All-Distance Series
Example: all-distance series, series represented as a list of
pitches. To better understand the output, the list of distances
between neighbouring pitches is shown as well.
declare
proc {AllDistanceSeries Solution}
N = 12 % Solution series length
N1 = N-1
Pitches Intervals % Vars for series and intervals
in
Solution = unit(pitches:Pitches intervals:Intervals)
Pitches = {FD.list N 0#N1} % List of FD vars in [0,N-1]
Intervals = {FD.list N1 1#N1}
for
Pitch1 in {List.take Pitches N1} % butlast of Pitches
Pitch2 in Pitches.2 % tail of Pitches
Interval in Intervals
do
{FD.distance Pitch1 Pitch2 '=:' Interval}
end
{FD.distinctD Pitches} % no pitch class repetition
{FD.distinctD Intervals} % no (abs) interval repetition
%% Specify search strategy
{FD.distribute ff Pitches}
end
{Browse {SearchOne AllDistanceSeries}}
{ExploreOne AllDistanceSeries}