Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* le-clojure.el (lispy-flatten--clojure-loaded): New defvar. (lispy-flatten--clojure-load): New defun. (lispy-flatten--clojure): Update. The code now can distinguish macros and use `macroexpand' for them. Otherwise, some custom Clojure code will be used to flatten. "xf" should work on this: (filter odd? [1 2 3 4 5]) After "xfM" you get: (let [pred odd? coll [1 2 3 4 5] ] (lazy-seq (when-let [s (seq coll) ] (if (chunked-seq? s) (let [c (chunk-first s) size (count c) b (chunk-buffer size) ] (dotimes [i size] (when (pred (.nth c i)) (chunk-append b (.nth c i)))) (chunk-cons (chunk b) (filter pred (chunk-rest s)))) (let [f (first s) r (rest s) ] (if (pred f) (cons f (filter pred r)) (filter pred r))))))) Re purcell#54.
- Loading branch information