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.

range function

Featured Replies

Hello,

is there a simple range function in Opusmodus (no vector) like this?:

(defun range (lis min max)
"
Range a list between min and max.
Ex.:
;; (range '(1 2 3 4 5) 1 2) => (1.0 1.25 1.5 1.75 2.0)
;; (range '(1 3 6 7) 1 2) => (1.0 1.3333334 1.8333334 2.0)
;; (range '(2 3 6 4 5 8 6 7) 2 3) => (2.0 2.1666667 2.6666667 2.3333333 2.5 3.0 2.6666667 2.8333333)
;; (range '(0.2 0.4 0.7 0.3 0.9) 0.3 1.2)
"
(let ((minlis (reduce #'min lis))
(maxlis (reduce #'max lis)))
(labels ((map-range (a1 a2 b1 b2 s)
(* 1.0 (+ b1
(/ (* (- s a1)
(- b2 b1))
(- a2 a1))))))
(loop for i in lis
collect (map-range minlis maxlis min max i)))))

Achim

vector-scale works with lists.

Jesper

;;;;

(vector-scale 1.0 2.0 '(1 2 3 4 5))

(vector-scale 1.0 2.0 '(1 3 6 7))

(defun range (lis min max)

(vector-scale (float min) (float max) lis))

(Note that range is already used in OM, so not a good function name.)

(range '(1 2 3 4 5) 1 2)

=> (1.0 1.25 1.5 1.75 2.0)

(range '(1 3 6 7) 1 2)

=> (1.0 1.3333334 1.8333334 2.0)

(range '(2 3 6 4 5 8 6 7) 2 3)

=> (2.0 2.1666667 2.6666667 2.3333333 2.5 3.0 2.6666667 2.8333333)

(range '(0.2 0.4 0.7 0.3 0.9) 0.3 1.2)

=>(0.3 0.55714286 0.9428572 0.42857146 1.2)

  • opmo changed the title to range function

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

Important Information

Terms of Use Privacy Policy

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.