Avner Dorman Posted February 14, 2017 Share Posted February 14, 2017 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! Quote Link to comment Share on other sites More sharing options...
opmo Posted February 14, 2017 Share Posted February 14, 2017 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 Quote Link to comment Share on other sites More sharing options...
Avner Dorman Posted February 14, 2017 Author Share Posted February 14, 2017 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!!! Quote Link to comment Share on other sites More sharing options...
opmo Posted February 14, 2017 Share Posted February 14, 2017 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) Stephane Boussuge and lviklund 2 Quote Link to comment Share on other sites More sharing options...
Avner Dorman Posted February 14, 2017 Author Share Posted February 14, 2017 Thank you so much! Quote Link to comment Share on other sites More sharing options...
Avner Dorman Posted May 10, 2018 Author Share Posted May 10, 2018 Hi Janusz, Any idea why this stopped working? I've changed :map shift to :map step but it's still not working... thanks! Avner Quote Link to comment Share on other sites More sharing options...
opmo Posted May 10, 2018 Share Posted May 10, 2018 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. Quote Link to comment Share on other sites More sharing options...
Avner Dorman Posted May 10, 2018 Author Share Posted May 10, 2018 Thanks! Now it's working for me too.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.