Fork me on GitHub

I am trying to do this:

(select (srange 0 3) (select [ALL (selected? pred)] collection))
Is there a way to pop back up to a view of the collection before selecting each node through ALL, idiomatically in one path, instead of using two functions and nesting one? I'm assuming there would be a transducer-like performance benefit to this, am I right? Alternatively, can srange be used after ALL to still filter the root nodes in the collection?


Also, is there a way to do side effects in the middle of a compound path like [path1 (side-effect-fn) path2] Or would it better to collect the necessary value for the side effect, then use a transform fn:

(transform [path1 collect path2] #(do (side-effect-fn %1) (main-fn %2)) collection)


@chromalchemy that first path is best written as (select-any [(filterer pred) (srange 0 3)] collection)


you could do side effects in a path with something like:

(defn side-effect [f]
  (view (fn [v] (f v) v)))


seems weird to me though to do something like that


@nathanmarz Thank you. I will get to know subselect and select-any.