oneof   macro


Defined in:  https://github.com/lambdamusic/extempore-extensions/blob/main/init/init_lisp.xtm

Implementation

;
; ONEOF: like random, but doesn't requires parenthesis :  (oneof c5 c6 c7)
; (oneof 5 6)  => 5 or 6
; (oneof 5)  => 5 
; (oneof '(5 6))  => 5 or 6 
; (oneof c5 c6)   => 72 or 84
; (oneof (--domaggiore 45 8)) ==> a note in the scale
(define-macro (oneof . args)
   (cond ((length-equal? args 0)
          (print 'please 'provide 'arguments))
         ((length-equal? args 1)
          `(cond ((list? ,@args)
                  (random ,@args))
                 (#t ,@args)))
         (#t `(random (list ,@args)))))


Back to Index