;;;
;;; c:\\program files\\acl62\\music41.cl
;;;
(load "c:\\program files\\acl62\\music40.cl")

(defun tell-a-pair-again (l)
  (let ((lst (collect-pairs l)))
    (do ((ll lst (cdr ll)))
       ((null ll))
     (format t "~%************************ ~a ***********************." (car ll))
     (tell-a-pair-aux (car ll)))))

;;;
;;; (tell-pairs-again *w1*)
;;;
(defun tell-pairs-again (wn)
  (tagbody
    (my-randomize)
    (format t "~%***** ~a *****" (second (first wn)))
    (format t "~%The original key is ~a." (first (first wn)))
    (format t "~%Enter a key.")
    loop1
    (setf l1 (read-sentence))
    (if (not (key-p (car l1)))
      (go loop1))
    (if (equal (car l1) (first (first wn)))
      (setf l2 (cdr wn))
     (setf l2 (modulate-key1-to-key2 (cdr wn) (first (first wn)) (car l1))))
    (tell-a-pair-again l2)))

;;;
;;; (indicate-a-key 'C 'major) (indicate-a-key 'C 'minor) etc.
;;;
(defun indicate-a-key (key type)
  (format t "~%***** On the key ~a. *****" (concatenate 'string (string key) "-" (string type)))
  (format t "~%~a." (rest (instantiate-a-key key type))))

;;;
;;; (get-chords-of-a-function-in-a-key 'C 'major 'tonic)
;;;
(defun get-chords-of-a-function-in-a-key (key type function)
  (let ((lst (instantiate-a-key key type)))
    (cdr (second (assoc function (cdr lst))))))

;;;
;;; (get-all-DC-chords "G7")
;;;
(defun get-all-DC-chords (dominant-chord)
  (append (get-DC dominant-chord 1)
        (list (car (get-DC dominant-chord 2)))
        (list (car (get-DC dominant-chord 3)))
        (list (car (get-DC dominant-chord 4)))))

(defun indicate-all-DC-chords (dc)
  (format t "~%For ~a all DC chords are ~a." dc (get-all-DC-chords dc)))