Class
palindromeEnumerates data forwards and backwards. Sub-patterns continue to produce their own (local) orderings.
palindrome supports the following slot initializations:
:elide {boolean | :first | :last | pattern}:first or the :last can be elided. The value can also be a
pattern, in which case a new elision value will be chosen each period
of the pattern. The default value is false.
See generic pattern initializations for documentation on additional keyword initializations to the pattern.
;; The palindrome pattern. (define pat1 (new palindrome :of '(a b c d))) (next pat1 16) ⇒ (a b c d d c b a a b c d d c b a) (define pat1 (new palindrome :of '(a b c d) :elide #t)) (next pat1 12) ⇒ (a b c d c b a b c d c b a b c d) ;; The effect of eliding. (define (play-pal reps trope rate) (let ((p (new palindrome :keynums trope :repeat reps :elide (new cycle :of '(#f #t :first :last))))) (process for k = (next p) until (eod? p) output (new midi :time (now) :duration (* rate 1.5) :keynum k) wait rate))) (events (play-pal 8 '(a4 b c5 d e) .2) "test.mid") ⇒ "test.mid"