Skip to content
View in the app

A better way to browse. Learn more.

Opusmodus

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

modify-lengths-to-rests

Featured Replies

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; i needed a function who changes randomly lengths to rests
;;; step by step, and modify (enlarge) its rest-values over x-generations
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(defun modify-lengths-to-rests (liste &key (items 1) (step -1) (factor 2) (enlarge-type 'add))
  (let ((liste (loop for j in liste
                   when (< j 0) collect (cond ((equal enlarge-type 'add)
                                               (+ step j))
                                              ((equal enlarge-type 'augmented)
                                               (* factor j)))
                   else collect j)))
    (loop 
      for i in liste
      
      with repl = (rnd-pick (remove 0 liste :test #'>))
      with cnt = 0
      when (and (equal i repl)
                (< cnt items)) 
      collect (* -1 (abs repl)) and do (incf cnt)
      else collect i)))
       

;;;; examples-1 -> ONE generation
;;;; evaluate a few times to see how it works

(modify-lengths-to-rests '(1 1 1 2 2 2 3 3 3 4 4 4 -5 5 5) 
                         :items 1
                         :enlarge-type 'add) ;enlarge only values < 0

(modify-lengths-to-rests '(1 1 1 2 2 2 3 3 3 4 4 4 -5 5 5) 
                         :items 2
                         :enlarge-type 'add) ;enlarge only values < 0

(modify-lengths-to-rests '(1 1 1 2 2 2 3 3 3 4 4 4 -5 5 5) 
                         :items 3
                         :enlarge-type 'add) ;enlarge only values < 0

;;;; examples-2 
;;;; recursiv - with x-generations

(loop repeat 10
  with seq = '(1 2 3 4 4 4 5 6 7)
  collect (setf seq (modify-lengths-to-rests seq 
                                             :items 1
                                             :enlarge-type 'augmented)))

(loop repeat 10
  with seq = '(1 2 3 4 4 4 5 6 7)
  collect (setf seq (modify-lengths-to-rests seq 
                                             :items 1
                                             :enlarge-type 'add)))

 

Create an account or sign in to comment


Copyright © 2014-2026 Opusmodus™ Ltd. All rights reserved.
Product features, specifications, system requirements and availability are subject to change without notice.
Opusmodus, the Opusmodus logo, and other Opusmodus trademarks are either registered trademarks or trademarks of Opusmodus Ltd.
All other trademarks contained herein are the property of their respective owners.

Powered by Invision Community

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.