Jump to content

gen-rotate extension


Recommended Posts

perhaps OPMO could extend its GEN-ROTATE like that (or use this CODE for it)... not only single-steps, also a list of steps...

 

;;; SIMPLE FUNCTION

(defun gen-rotate* (alist seq)
  (loop 
    for i in alist
    collect (setf seq (gen-rotate i seq))))

;;; EXAMPLES

(list-plot 
 (flatten 
  (gen-rotate* '(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18) '(1 2 3 4 5 6 7 8 9 10)))
   :join-points t :point-radius 0 :style :fill)

(list-plot 
 (gen-rotate* '(9 8 7 6 5 4 3 2 1) '(1 2 3 4 5 6 7 8 9 10))
   :join-points t :point-radius 0 :style :fill)

(list-plot 
 (flatten 
  (gen-rotate* '(1 2 3 4 5 4 3 2 1) '(1 2 3 4 5 6 7 8 9 10)))
   :join-points t :point-radius 0 :style :fill)

(list-plot 
 (gen-rotate* '(1 2 3 4 5 4 3 2 1) '(1 2 3 4 5 6 7 8 9 10))
 :join-points t :point-radius 0 :style :fill)

 

Link to comment
Share on other sites

I agree that this is useful, and therefore I also implemented a similar functionality in my function rotate-omn 🙂  You can find its documentation at https://tanders.github.io/tot/sources/form.html#_g229430 and download the whole library at https://github.com/tanders/tot.

 

BTW: You meanwhile should also have quite a sizeable collection of custom functions for Opusmodus. While not sharing them together in some kind of library as well? 

 

Best,

Torsten

 

Link to comment
Share on other sites

9 hours ago, torstenanders said:

BTW: You meanwhile should also have quite a sizeable collection of custom functions for Opusmodus. While not sharing them together in some kind of library as well? 

 

yes, of course - from "BOTs" to a lot of small simple FUNCTIONS... but: not very well/smart coded (🙄) - i'm musician but only an "amateur programmer" with few experience -  and it's really NOT well documentated for other users. and another point, i have no idea how do that professionally with GUTHUB and these installation-things 😕

 

as ORDINARY text - no problem. perhaps i will share it like that on my website...

 

 

Link to comment
Share on other sites

> i'm musician but only an "amateur programmer" 

 

I think the most important part is the musical knowledge encoded, and that your definitions work as described. How that is implemented is secondary for its use for others. (Clean implementations can make a big difference, though, for the maintainability of your code.) 

 

> I have no idea how to do that professionally with GitHub

 

I am pretty busy at this stage of the academic year, but in a few weeks, I would be happy to help you with that, if you want. What I cannot do, is documenting your definitions, but I can also show you, once you added some documentation in the form of doc strings added to your function etc. defs, how to automatically turn that into HTML docs. 

 

as ORDINARY text - no problem. perhaps i will share it like that on my website...

 

If such a straightforward approach makes you feel you are more in control, then why not? However, in your place, I would add some doc strings that explain what a function is supposed to do. That makes it also more easy for yourself to re-use these functions at some later time. 

 

Best,

Torsten

 

Link to comment
Share on other sites

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