every   macro


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

Implementation

;
;
;; EVERY N loops, do X (X is a sequence of procedures)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Requires `lc` symbol to be in scope and incremented at each iteration
;
; (let ((lc 4))
;   (every 2 (println 'hi) (println 'there))
;   )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(impc:aot:do-or-emit
    (define-macro (every n . args)
    ;    (println 'args n args)
    `(if (= (modulo lc ,n) 0)
            (begin ,@args)))
)


Back to Index

Similar Entries