A library for rearranging filter map join, etc. Clojure style


I've seen a Racket library which allows for structuring filtering and mapping Clojure style, like this:

  (->> (-> (cs/replace authors #"\"(?:\\.|[^\"\\])*\"" " ")  ;; Remove quoted substrings.
           (cs/replace #"\"" " ")  ;; Remove odd quotes.
           (cs/split #","))
       (filter (fn [author]
                 (-> (cs/replace author #"[-.]+" "")
       (map (fn [author] (as-> (cs/split author #"-") b

So far as I can remember, even ->> was there. I can't find anything, though.

You're probably thinking of threading.

In addition to threading, there’s also Qi and at least one “Racket like it’s Clojure” package. I recommend searching the docs for -> and ~> and seeing possibilities come up.

Yes, it's about threading (?), and the keyword that stuck in my memory is ~>>, not ->>, from Qi :blush: .

Why are there so many almost identical libraries?

Just in case I wasn't clear, I mean there's a racket library named threading. I can't tell if you're saying it's about threading (the concept) or the library by that name.

I'm not sure about the terminology. It looks like threading and qi do much the same thing.

Qi builds on threading (at least conceptually) but offers quite a bit more. For example: (define-flow avg (~> (-< + count) /)) defines a variadic avg that computes the average of it’s numerical inputs.

The threading library mentioned above has a simplified version called "create threading in 2 easy steps",