There isn’t a closure tag, so I put this under the lisp tag.
closure
lisp
The most interesting one for me was learning about the skip argument to partition, used in the cycle example:
skip
partition
cycle
Among the things we can do with cycle is writing a function that produces a list of all the rotations of a given collection (defn rotations [coll] (take (count coll) (partition (count coll) 1 (cycle coll)))) (rotations "dave") ;=> ((\d \a \v \e) (\a \v \e \d) (\v \e \d \a) (\e \d \a \v))
Among the things we can do with cycle is writing a function that produces a list of all the rotations of a given collection
(defn rotations [coll] (take (count coll) (partition (count coll) 1 (cycle coll)))) (rotations "dave") ;=> ((\d \a \v \e) (\a \v \e \d) (\v \e \d \a) (\e \d \a \v))
I though that was very clever.
The most interesting one for me was learning about the
skipargument topartition, used in thecycleexample:I though that was very clever.