Jump to content
Sign in to follow this  
JulioHerrlein

Modulo 12 Function ?

Recommended Posts

Dear Friends,

 

I'm struggling to find a modulo 12 function

Something like this:

(mod12 '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 24 48))

returns >> (0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 0 0)

 

Any Hint ?

Best,

Julio

Share this post


Link to post
Share on other sites

Dear Julio,

Yes, it's modus. I like work with integer and the Set Theory. 

Best.

Didier

(pcs-analysis (integer-to-pitch (modus (pitch-to-integer '(fs5g6c8 fs4g4c4)))))

Share this post


Link to post
Share on other sites

You can roll such a function easily yourself. The modulus function is part of Common Lisp.

 

;; modulus 12 of 60

(mod 60 12)

; => 0

 

(defun mod12 (xs)
  (loop for x in xs
    collect (mod x 12)))

 

(mod12 '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 24 48))
; => (0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 0 0)

 

To empower yourself, once you know how to program a simple function, you simply need to google for the modulus function

 

  http://lmgtfy.com/?q=common lisp modulo

 

:)

 

Best,

Torsten

Share this post


Link to post
Share on other sites

Great idea, Torsten 

Very pedagogic example too. 

Thanks a lot. 

Im studying a lot of diatonic set Theory now, so  I'm interested  on mod 12 and mod 7 operations. The problem with the diatonic stuff is that is,  in the lingo of Robert Morris, a pitch space with a irregular but periodic division. 

Best 

Julio 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×