(defun cycle-fns (&rest functions)
(let* ((n (length functions))
(p 0)
(array (loop
with a = (make-array (list n)
:element-type 'function
:initial-element #'identity)
for function in functions
for i from 0 to (1- n)
do (setf (aref a i) function)
finally (return a))))
(lambda (&rest args)
(prog1
(apply (aref array p) args)
(setf p (mod (1+ p) n))))))
(defun bbcode (tag)
(lambda (i)
(format nil "[~A]~A[/~A]" tag i tag)))