Skip to content

Instantly share code, notes, and snippets.

;; The ->> threading macro will normally place the previous form into the last argument position of the next form
;; However, there are times when you are working with functions that don't take the required parameter in the last spot
;; In this example, I'm extracting all path locations before /v
;; re-seq first and second all work with the threading macro
;; However, when it comes time to split the string result, clojure.string/split takes two arguments
;; The first is the string, and the second is the regular expression to split on.
;; For the threading macro to work as is, these arguments need to be reversed
;; One way of doing this is creating an anonymous function that does this
;; #(clojure.string/split % #"/") This is the function
;; Then you actually evaluate by wrapping it in paranthesis