Common algorithms, implemented in Clojure
(windowed v n)
returns a sliding window with size n, on the vector v.
Example:
(windowed 2 [1 2 3]) ;; => '([1 2] [2 3])
(intervals v)
returns a vector that contains every possible intervals of v.
Example:
(intervals [1 2 3]) ;; => '([1] [1 2] [1 2 3] [2] [2 3] [3])
($= & expr)
converts expr to a Lisp sexp (with support for order of operations).
Example:
($= 5 + 5 * 5) ;; => 30
(macroexpand '($= 5 + 5 * 5)) ;; => (+ (* 5 5) 5)
Coming soon...