Jump to content
Sign in to follow this  


Recommended Posts

;; LENGTH-REST-RATIO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; to TEST in a OMN- or LENGTH-sequence

(defun length-rest-ratio (seq)
  (let ((liste (omn :length seq)))
    (loop for i in liste
      when (< i 0) sum (abs i) into -bag
      when (> i 0) sum i into +bag
      finally (return (ratio-to-float (* +bag (/ 1 (+ +bag -bag))))))))

(length-rest-ratio '(e. q. -q))
(length-rest-ratio '(-2 3 4 -1 -1))
(length-rest-ratio '(e. c4 ppp -q. q d3 e3 f3))
;;; evaluate this test a few times    
(if (> (length-rest-ratio (rnd-repeat 10 '(1 2 3 4 -1 -2 -3 -4))) 0.5)
  (append 'more-lengths)
  (append 'more-rests))


Share this post

Link to post
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.

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.

Sign in to follow this  

  • Create New...