Hi all,
I’m a relative newcomer to OM, please forgive me if this info is well documented somewhere. My question involves the treatment of variables in OM. I am working on a patch to generate pitch material, and want to feed it a start pitch, then the following type of list:
((direction interval) direction direction (direction new-interval) direction direction etc)
I’m easily able to make it work using omloop if I retype the interval every time, like this:
(direction interval) (direction interval-again) etc.)
It just seems like I should just be able to store “interval” as a variable, access it when not-a-list comes through, and update it when a list comes through.
Like this:
(setf intervals '((1 400) -1 1 (1 200) 1 -1))
(defun interval-list (full-list)
(let ((result nil))
(dolist (e full-list (reverse result))
(push (if (listp e)
(* (first e)
(setf multiplier (second e)))
(* e multiplier))
result))))
- or -
(defun interval-list (element)
(if (listp element)
(* (first element)
(setf multiplier (second element)))
(* element multiplier)))
(mapcar #'interval-list intervals)
I realize I could just use this lisp code in OM, but I suspect it would be helpful in general to know how to store a variable. Or perhaps I’m thinking of this in the wrong way?
I’m happy to be pointed to documentation where this is addressed, just can’t find any that applies. Thanks for any help!
Per