chickadee » generalized-arrays » interleave-interval

interleave-interval intervalprocedure
reverse-interleave-interval intervalprocedure

Transducers that interleave the indeices contained within the interval with another transduction, in forward or reverse order.

 
(import (generalized-arrays intervals)
        (transducers)
        (test))

(test "Interleaving an interval onto elements of a list"
      (list 'a (vector 0 0)
            'b (vector 0 1)
            'c (vector 1 0)
            'd (vector 1 1))
      (transduce list-fold
                 (zip-interval
                   (make-default-interval (vector 2 2)))
                 (collect-list)
                 (list 'a 'b 'c 'd 'e)))