From 814320124e67ff42cac90084bc873b5c594754b5 Mon Sep 17 00:00:00 2001
From: Lorenz Lehmann <lorenz.lehmann@students.muho-mannheim.de>
Date: Mon, 12 Feb 2024 07:36:52 +0100
Subject: [PATCH] fix (sources): rule lists have the correct length

---
 sources/gen-sequence.lisp |  202 +++++++++++++++++++++++---------------------------
 1 files changed, 94 insertions(+), 108 deletions(-)

diff --git a/sources/gen-sequence.lisp b/sources/gen-sequence.lisp
index f9c2de7..521e950 100644
--- a/sources/gen-sequence.lisp
+++ b/sources/gen-sequence.lisp
@@ -36,133 +36,119 @@
           (loop repeat (- number-of-harmonies 1)
                 for database in database
                                     
-                for voice-tie1 in (cond ((atom voice-tie1) (loop repeat number-of-harmonies collect voice-tie1))
-                                        ((< (length voice-tie1) number-of-harmonies) 
-                                         (append voice-tie1 (loop repeat (- number-of-harmonies (length voice-tie1)) collect (car (reverse voice-tie1)))))
+                for voice-tie1 in (cond ((atom voice-tie1) (loop repeat (1- number-of-harmonies) collect voice-tie1))
+                                        ((< (length voice-tie1) (1- number-of-harmonies)) 
+                                         (append voice-tie1 (loop repeat (- (1- number-of-harmonies) (length voice-tie1)) collect (car (reverse voice-tie1)))))
                                         (t voice-tie1))
-                for voice-tie2 in (cond ((atom voice-tie2) (loop repeat number-of-harmonies collect voice-tie2))
-                                        ((< (length voice-tie2) number-of-harmonies) 
-                                         (append voice-tie2 (loop repeat (- number-of-harmonies (length voice-tie2)) collect (car (reverse voice-tie2)))))
+                for voice-tie2 in (cond ((atom voice-tie2) (loop repeat (1- number-of-harmonies) collect voice-tie2))
+                                        ((< (length voice-tie2) (1- number-of-harmonies)) 
+                                         (append voice-tie2 (loop repeat (- (1- number-of-harmonies) (length voice-tie2)) collect (car (reverse voice-tie2)))))
                                 (t voice-tie2))
-                for voice-tie3 in (cond ((atom voice-tie3) (loop repeat number-of-harmonies collect voice-tie3))
-                                        ((< (length voice-tie3) number-of-harmonies) 
-                                         (append voice-tie3 (loop repeat (- number-of-harmonies (length voice-tie3)) collect (car (reverse voice-tie3)))))
+                for voice-tie3 in (cond ((atom voice-tie3) (loop repeat (1- number-of-harmonies) collect voice-tie3))
+                                        ((< (length voice-tie3) (1- number-of-harmonies)) 
+                                         (append voice-tie3 (loop repeat (- (1- number-of-harmonies) (length voice-tie3)) collect (car (reverse voice-tie3)))))
                                 (t voice-tie3))
-                for voice-tie4 in (cond ((atom voice-tie4) (loop repeat number-of-harmonies collect voice-tie4))
-                                        ((< (length voice-tie4) number-of-harmonies) 
-                                         (append voice-tie4 (loop repeat (- number-of-harmonies (length voice-tie4)) collect (car (reverse voice-tie4)))))
+                for voice-tie4 in (cond ((atom voice-tie4) (loop repeat (1- number-of-harmonies) collect voice-tie4))
+                                        ((< (length voice-tie4) (1- number-of-harmonies)) 
+                                         (append voice-tie4 (loop repeat (- (1- number-of-harmonies) (length voice-tie4)) collect (car (reverse voice-tie4)))))
                                 (t voice-tie4))
 
                 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-                for voice-interval1 in (cond ((atom (car voice-interval1)) (loop repeat number-of-harmonies collect voice-interval1))
-                                             ((< (length voice-interval1) number-of-harmonies) 
-                                              (append voice-interval1 (loop repeat (- number-of-harmonies (length voice-interval1)) collect (car (reverse voice-interval1)))))
+                for voice-interval1 in (cond ((atom (car voice-interval1)) (loop repeat (1- number-of-harmonies) collect voice-interval1))
+                                             ((< (length voice-interval1) (1- number-of-harmonies)) 
+                                              (append voice-interval1 (loop repeat (- (1- number-of-harmonies) (length voice-interval1)) collect (car (reverse voice-interval1)))))
                                              (t voice-interval1))
-                for voice-interval2 in (cond ((atom (car voice-interval2)) (loop repeat number-of-harmonies collect voice-interval2))
-                                             ((< (length voice-interval2) number-of-harmonies) 
-                                              (append voice-interval2 (loop repeat (- number-of-harmonies (length voice-interval2)) collect (car (reverse voice-interval2)))))
+                for voice-interval2 in (cond ((atom (car voice-interval2)) (loop repeat (1- number-of-harmonies) collect voice-interval2))
+                                             ((< (length voice-interval2) (1- number-of-harmonies)) 
+                                              (append voice-interval2 (loop repeat (- (1- number-of-harmonies) (length voice-interval2)) collect (car (reverse voice-interval2)))))
                                              (t voice-interval2))
-                for voice-interval3 in (cond ((atom (car voice-interval3)) (loop repeat number-of-harmonies collect voice-interval3))
-                                             ((< (length voice-interval3) number-of-harmonies) 
-                                              (append voice-interval3 (loop repeat (- number-of-harmonies (length voice-interval3)) collect (car (reverse voice-interval3)))))
+                for voice-interval3 in (cond ((atom (car voice-interval3)) (loop repeat (1- number-of-harmonies) collect voice-interval3))
+                                             ((< (length voice-interval3) (1- number-of-harmonies)) 
+                                              (append voice-interval3 (loop repeat (- (1- number-of-harmonies) (length voice-interval3)) collect (car (reverse voice-interval3)))))
                                              (t voice-interval3))
-                for voice-interval4 in (cond ((atom (car voice-interval4)) (loop repeat number-of-harmonies collect voice-interval4))
-                                             ((< (length voice-interval4) number-of-harmonies) 
-                                              (append voice-interval4 (loop repeat (- number-of-harmonies (length voice-interval4)) collect (car (reverse voice-interval4)))))
+                for voice-interval4 in (cond ((atom (car voice-interval4)) (loop repeat (1- number-of-harmonies) collect voice-interval4))
+                                             ((< (length voice-interval4) (1- number-of-harmonies)) 
+                                              (append voice-interval4 (loop repeat (- (1- number-of-harmonies) (length voice-interval4)) collect (car (reverse voice-interval4)))))
                                              (t voice-interval4))
 
                 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-                for voice-counter1 in (if (eq nil voice-counter1) (loop repeat number-of-harmonies collect nil)
-                                        
-                                        (mat-trans_oml (list (cond ((not (listp (caar voice-counter1))) (loop repeat number-of-harmonies collect (car voice-counter1)))
-                                                                   ((< (length (car voice-counter1)) number-of-harmonies) 
-                                                                    (append (car voice-counter1) (loop repeat (- number-of-harmonies (length (car voice-counter1)))
-                                                                                                       collect (car (reverse (car voice-counter1))))))
-                                                                   (t (car voice-counter1)))
-                                                             (cond ((< (length (cadr voice-counter1)) number-of-harmonies)
-                                                                    (append (cadr voice-counter1) (loop repeat (- number-of-harmonies (length (cadr voice-counter1))) 
-                                                                                                        collect (car (reverse (cadr voice-counter1))))))
-                                                                   (t (cadr voice-counter1))))))
-                for voice-counter2 in (if (eq nil voice-counter2) (loop repeat number-of-harmonies collect nil)
-                                        
-                                        (mat-trans_oml (list (cond ((not (listp (caar voice-counter2))) (loop repeat number-of-harmonies collect (car voice-counter2)))
-                                                                   ((< (length (car voice-counter2)) number-of-harmonies) 
-                                                                    (append (car voice-counter2) (loop repeat (- number-of-harmonies (length (car voice-counter2)))
-                                                                                                       collect (car (reverse (car voice-counter2))))))
-                                                                   (t (car voice-counter2)))
-                                                             (cond ((< (length (cadr voice-counter2)) number-of-harmonies)
-                                                                    (append (cadr voice-counter2) (loop repeat (- number-of-harmonies (length (cadr voice-counter2))) 
-                                                                                                        collect (car (reverse (cadr voice-counter2))))))
-                                                                   (t (cadr voice-counter2))))))
-                for voice-counter3 in (if (eq nil voice-counter3) (loop repeat number-of-harmonies collect nil)
-                                        
-                                        (mat-trans_oml (list (cond ((not (listp (caar voice-counter3))) (loop repeat number-of-harmonies collect (car voice-counter3)))
-                                                                   ((< (length (car voice-counter3)) number-of-harmonies) 
-                                                                    (append (car voice-counter3) (loop repeat (- number-of-harmonies (length (car voice-counter3)))
-                                                                                                       collect (car (reverse (car voice-counter3))))))
-                                                                   (t (car voice-counter3)))
-                                                             (cond ((< (length (cadr voice-counter3)) number-of-harmonies)
-                                                                    (append (cadr voice-counter3) (loop repeat (- number-of-harmonies (length (cadr voice-counter3))) 
-                                                                                                        collect (car (reverse (cadr voice-counter3))))))
-                                                                   (t (cadr voice-counter3))))))
-                for voice-counter4 in (if (eq nil voice-counter4) (loop repeat number-of-harmonies collect nil)
-                                        
-                                        (mat-trans_oml (list (cond ((not (listp (caar voice-counter4))) (loop repeat number-of-harmonies collect (car voice-counter4)))
-                                                                   ((< (length (car voice-counter4)) number-of-harmonies) 
-                                                                    (append (car voice-counter4) (loop repeat (- number-of-harmonies (length (car voice-counter4)))
-                                                                                                       collect (car (reverse (car voice-counter4))))))
-                                                                   (t (car voice-counter4)))
-                                                             (cond ((< (length (cadr voice-counter4)) number-of-harmonies)
-                                                                    (append (cadr voice-counter4) (loop repeat (- number-of-harmonies (length (cadr voice-counter4))) 
-                                                                                                        collect (car (reverse (cadr voice-counter4))))))
-                                                                   (t (cadr voice-counter4))))))
-                for voice-counter5 in (if (eq nil voice-counter5) (loop repeat number-of-harmonies collect nil)
-                                        
-                                        (mat-trans_oml (list (cond ((not (listp (caar voice-counter5))) (loop repeat number-of-harmonies collect (car voice-counter5)))
-                                                                   ((< (length (car voice-counter5)) number-of-harmonies) 
-                                                                    (append (car voice-counter5) (loop repeat (- number-of-harmonies (length (car voice-counter5)))
-                                                                                                       collect (car (reverse (car voice-counter5))))))
-                                                                   (t (car voice-counter5)))
-                                                             (cond ((< (length (cadr voice-counter5)) number-of-harmonies)
-                                                                    (append (cadr voice-counter5) (loop repeat (- number-of-harmonies (length (cadr voice-counter5))) 
-                                                                                                        collect (car (reverse (cadr voice-counter5))))))
-                                                                   (t (cadr voice-counter5))))))
-                for voice-counter6 in (if (eq nil voice-counter6) (loop repeat number-of-harmonies collect nil)
-                                        
-                                        (mat-trans_oml (list (cond ((not (listp (caar voice-counter6))) (loop repeat number-of-harmonies collect (car voice-counter6)))
-                                                                   ((< (length (car voice-counter6)) number-of-harmonies) 
-                                                                    (append (car voice-counter6) (loop repeat (- number-of-harmonies (length (car voice-counter6)))
-                                                                                                       collect (car (reverse (car voice-counter6))))))
-                                                                   (t (car voice-counter6)))
-                                                             (cond ((< (length (cadr voice-counter6)) number-of-harmonies)
-                                                                    (append (cadr voice-counter6) (loop repeat (- number-of-harmonies (length (cadr voice-counter6))) 
-                                                                                                        collect (car (reverse (cadr voice-counter6))))))
-                                                                   (t (cadr voice-counter6))))))
+                for voice-counter1 in (cond ((atom voice-counter1) 
+                                             (loop repeat (1- number-of-harmonies) collect voice-counter1)) 
+                                            ((listp (caar voice-counter1)) 
+                                             (if (< (length voice-counter1) (1- number-of-harmonies)) 
+                                                 (loop repeat (- (1- number-of-harmonies) (length voice)) collect (car voice-counter1))
+                                               voice-counter1))
+                                            (t (loop repeat (1- number-of-harmonies) collect voice-counter1)))
+            
+      
+                for voice-counter2 in (cond ((atom voice-counter2) 
+                                             (loop repeat (1- number-of-harmonies) collect voice-counter2)) 
+                                            ((listp (caar voice-counter2)) 
+                                             (if (< (length voice-counter2) (1- number-of-harmonies)) 
+                                                 (loop repeat (- (1- number-of-harmonies) (length voice)) collect (car voice-counter2))
+                                               voice-counter2))
+                                            (t (loop repeat (1- number-of-harmonies) collect voice-counter2)))
+
+
+                for voice-counter3 in (cond ((atom voice-counter3) 
+                                             (loop repeat (1- number-of-harmonies) collect voice-counter3)) 
+                                            ((listp (caar voice-counter3)) 
+                                             (if (< (length voice-counter3) (1- number-of-harmonies)) 
+                                                 (loop repeat (- (1- number-of-harmonies) (length voice)) collect (car voice-counter3))
+                                               voice-counter3))
+                                            (t (loop repeat (1- number-of-harmonies) collect voice-counter3)))
+
+
+                for voice-counter4 in (cond ((atom voice-counter4) 
+                                             (loop repeat (1- number-of-harmonies) collect voice-counter4)) 
+                                            ((listp (caar voice-counter4)) 
+                                             (if (< (length voice-counter4) (1- number-of-harmonies)) 
+                                                 (loop repeat (- (1- number-of-harmonies) (length voice)) collect (car voice-counter4))
+                                               voice-counter4))
+                                            (t (loop repeat (1- number-of-harmonies) collect voice-counter4)))
+
+
+                for voice-counter5 in (cond ((atom voice-counter5) 
+                                             (loop repeat (1- number-of-harmonies) collect voice-counter5)) 
+                                            ((listp (caar voice-counter5)) 
+                                             (if (< (length voice-counter5) (1- number-of-harmonies)) 
+                                                 (loop repeat (- (1- number-of-harmonies) (length voice)) collect (car voice-counter5))
+                                               voice-counter5))
+                                            (t (loop repeat (1- number-of-harmonies) collect voice-counter5)))
+
+
+                for voice-counter6 in (cond ((atom voice-counter6) 
+                                             (loop repeat (1- number-of-harmonies) collect voice-counter6)) 
+                                            ((listp (caar voice-counter6)) 
+                                             (if (< (length voice-counter6) (1- number-of-harmonies)) 
+                                                 (loop repeat (- (1- number-of-harmonies) (length voice)) collect (car voice-counter6))
+                                               voice-counter6))
+                                            (t (loop repeat (1- number-of-harmonies) collect voice-counter6)))
 
                 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-                for counter-interval1 in (cond ((atom (car counter-interval1)) (loop repeat number-of-harmonies collect counter-interval1))
-                                               ((< (length counter-interval1) number-of-harmonies) 
-                                                (append counter-interval1 (loop repeat (- number-of-harmonies (length counter-interval1)) collect (car (reverse counter-interval1)))))
+                for counter-interval1 in (cond ((atom (car counter-interval1)) (loop repeat (1- number-of-harmonies) collect counter-interval1))
+                                               ((< (length counter-interval1) (1- number-of-harmonies)) 
+                                                (append counter-interval1 (loop repeat (- (1- number-of-harmonies) (length counter-interval1)) collect (car (reverse counter-interval1)))))
                                                (t counter-interval1))
-                for counter-interval2 in (cond ((atom (car counter-interval2)) (loop repeat number-of-harmonies collect counter-interval2))
-                                               ((< (length counter-interval2) number-of-harmonies) 
-                                                (append counter-interval2 (loop repeat (- number-of-harmonies (length counter-interval2)) collect (car (reverse counter-interval2)))))
+                for counter-interval2 in (cond ((atom (car counter-interval2)) (loop repeat (1- number-of-harmonies) collect counter-interval2))
+                                               ((< (length counter-interval2) (1- number-of-harmonies)) 
+                                                (append counter-interval2 (loop repeat (- (1- number-of-harmonies) (length counter-interval2)) collect (car (reverse counter-interval2)))))
                                                (t counter-interval2))
-                for counter-interval3 in (cond ((atom (car counter-interval3)) (loop repeat number-of-harmonies collect counter-interval3))
-                                               ((< (length counter-interval3) number-of-harmonies) 
-                                                (append counter-interval3 (loop repeat (- number-of-harmonies (length counter-interval3)) collect (car (reverse counter-interval3)))))
+                for counter-interval3 in (cond ((atom (car counter-interval3)) (loop repeat (1- number-of-harmonies) collect counter-interval3))
+                                               ((< (length counter-interval3) (1- number-of-harmonies)) 
+                                                (append counter-interval3 (loop repeat (- (1- number-of-harmonies) (length counter-interval3)) collect (car (reverse counter-interval3)))))
                                                (t counter-interval3))
-                for counter-interval4 in (cond ((atom (car counter-interval4)) (loop repeat number-of-harmonies collect counter-interval4))
-                                             ((< (length counter-interval4) number-of-harmonies) 
-                                              (append counter-interval4 (loop repeat (- number-of-harmonies (length counter-interval4)) collect (car (reverse counter-interval4)))))
+                for counter-interval4 in (cond ((atom (car counter-interval4)) (loop repeat (1- number-of-harmonies) collect counter-interval4))
+                                             ((< (length counter-interval4) (1- number-of-harmonies)) 
+                                              (append counter-interval4 (loop repeat (- (1- number-of-harmonies) (length counter-interval4)) collect (car (reverse counter-interval4)))))
                                              (t counter-interval4))
-                for counter-interval5 in (cond ((atom (car counter-interval5)) (loop repeat number-of-harmonies collect counter-interval5))
-                                               ((< (length counter-interval5) number-of-harmonies) 
-                                                (append counter-interval5 (loop repeat (- number-of-harmonies (length counter-interval5)) collect (car (reverse counter-interval5)))))
+                for counter-interval5 in (cond ((atom (car counter-interval5)) (loop repeat (1- number-of-harmonies) collect counter-interval5))
+                                               ((< (length counter-interval5) (1- number-of-harmonies)) 
+                                                (append counter-interval5 (loop repeat (- (1- number-of-harmonies) (length counter-interval5)) collect (car (reverse counter-interval5)))))
                                                (t counter-interval5))
-                for counter-interval6 in (cond ((atom (car counter-interval6)) (loop repeat number-of-harmonies collect counter-interval6))
-                                               ((< (length counter-interval6) number-of-harmonies) 
-                                                (append counter-interval6 (loop repeat (- number-of-harmonies (length counter-interval6)) collect (car (reverse counter-interval6)))))
+                for counter-interval6 in (cond ((atom (car counter-interval6)) (loop repeat (1- number-of-harmonies) collect counter-interval6))
+                                               ((< (length counter-interval6) (1- number-of-harmonies)) 
+                                                (append counter-interval6 (loop repeat (- (1- number-of-harmonies) (length counter-interval6)) collect (car (reverse counter-interval6)))))
                                                (t counter-interval6))
                 
 

--
Gitblit v1.9.1