grafter.sequences

A library of useful lazy sequences.

alphabetical-column-names

(alphabetical-column-names)

Returns an infinite sequence of alphabetized column names. If more than 26 are required the sequence will count AA AB AC … BA BB BC … ZZZA … etc

column-names-seq

(column-names-seq alphabet)

Given an alphabet string generate a lazy sequences of column names e.g.

(column-names-seq "abcdefghijklmnopqrstuvwxyz") ;; => ("a" "b" "c" ... "aa" "ab")

fill-when

(fill-when col)(fill-when p col)(fill-when p col start)

Takes a sequence of values and copies a value through the sequence depending on the supplied predicate function.

The default predicate function is not-blank? which means that a cell will be copied through the sequence over blank cells until the next non-blank one. For example:

(fill-when [:a "" " " :b nil nil nil]) ; => (:a :a :a :b :b :b :b)

A start value to copy can also be provided as the 3rd argument.

integers-from

(integers-from)(integers-from from)(integers-from from inc-by)

Returns an infinite sequence of integers counting from the supplied starting number.

Supports the use of an optional increment amount to allow increments of arbitrary or negative amounts.

If no arguments are supplied an infinite sequence of all positive integers from 1 is returned.