Jump to content

Recommended Posts

Posted

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

  • 3 weeks later...
Posted

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

Posted

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 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy