chickadee » generalized-arrays » interval-fold

interval-fold f sentinel xsprocedure
reverse-interval-fold f sentinel xsprocedure

Transducer-aware folding operations over intervals (forward and reverse).

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

(test "Transducing over interval values"
      (list (vector 0 0)
            (vector 0 1)
            (vector 1 0)
            (vector 1 1))
      (transduce interval-fold
                 values
                 (collect-list)
                 (make-default-interval (vector 2 2))))

(test "Transducing over interval values in reverse"
      (list (vector 1 1)
            (vector 1 0)
            (vector 0 1)
            (vector 0 0))
      (transduce reverse-interval-fold
                 values
                 (collect-list)
                 (make-default-interval (vector 2 2))))