Take n-th

a25

It’s possible to produce some interesting effects using Clojure’s take-nth function.

Here there’s a simple function to produce an n clock-rotate of an n-sided polygon, which is then mapped across a list of numbers to produce a sequence of different tiles and then cycled.

We can then use take-nth to sample this new infinite sequence out of the original order.

(defn n-ies [n] 
  (std/poly 0 0.5 0.4 n {:stroke (p-color 255 100 180 200) 
                         :stroke-weight 2 
                         :fill (p-color 50 150 255 100)}) )

(defn round [n] (layouts/clock-rotate n (n-ies n)))

(def pattern (layouts/grid-layout 8 
                 (take-nth 3 (cycle 
                      (map round [3 4 5 6 7 8 9 10])))))

Leave a Reply