Posted February 14, 20178 yr I have a basic lisp question - I'd like to create a function that takes a tonality as its argument and performs something like the following line: (setf test (tonality-map '((pcs '3-2) :root b3 :map shift) (make-scale 'c4 12))) So (defun pitches (tonality) .....) - and then (pitches (pcs '3-2)) would return the list (b3 c4 d4 b4 c5 d5 b5 c6 d6 b6 c7 d7) Thanks so much!
February 14, 20178 yr The return is what you are looking for: (tonality-map '((pcs '3-2) :root b3 :map shift) (make-scale 'c4 12)) => (b3 c4 d4 b4 c5 d5 b5 c6 d6 b6 c7 d7) or I don't understand you question
February 14, 20178 yr Author Sorry if I am not clear - yes the return is what I want. Now I'd like to have a new function that only accepts the collection and returns this same notes. So (newfunction (pcs '3-2)) gives the same result. These are obviously wrong - (defun newfunction (tonality) (tonality-map '((tonality) :root b3 :map shift) (make-scale 'c4 12))) (defun newfunction (tonality) (tonality-map '(tonality :root b3 :map shift) (make-scale 'c4 12))) My goal is to create more complex functions that make use of tonality-map - I realize this might seem unneeded in this simple example - but as the code gets complex I think this function would be helpful for me. Many Thanks!!!
February 14, 20178 yr Here it is: (defun tmap (tonality) (tonality-map `(,tonality :root b3 :map shift) (make-scale 'c4 12))) (tmap (pcs '3-2)) => (b3 c4 d4 b4 c5 d5 b5 c6 d6 b6 c7 d7)
May 10, 20186 yr Author Hi Janusz, Any idea why this stopped working? I've changed :map shift to :map step but it's still not working... thanks! Avner
May 10, 20186 yr Works here: (defun tmap (tonality) (tonality-map `(,tonality :root b3 :map step) (make-scale 'c4 12))) (tmap (pcs '3-2)) => (b3 c4 d4 b4 c5 d5 b5 c6 d6 b6 c7 d7) added 3 minutes later If you are getting an error you need to provide the expression otherwise I can't help.
Create an account or sign in to comment