Created
June 17, 2021 14:40
-
-
Save fogus/77c8d42d85594e3badb3f8ac3072737b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(deflinked abclink [a b c]) | |
;; expands to | |
(defn abclink [params] | |
(let [[to] (when-let [t (:to params)] (clojure.tools.build.api/qualify-fn-symbols [t]))] | |
(loop [parms params | |
remaining-tasks [build/a build/b build/c]] | |
(let [task (first remaining-tasks)] | |
(if task | |
(let [ret (task parms)] | |
(if (and to (= to task)) | |
ret | |
(recur ret (rest remaining-tasks)))) | |
parms))))) | |
;; called as | |
clj -X:build abclink ;; performs tasks a,b,c | |
;; or | |
clj -X:build abclink :to b ;; performs tasks a,b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment