Hello! I just started a week ago playing with babashka to rewrite some of mi CI scripts.
I wanted to ask about how should I structure my code, so I can easily build the script progresively by using the repl.
Basically, my scripts consist of a main function with various functions that apply to the result of the step before. My intial idea then was something like:
(defn -main [argument] (let [result1 (fn1 argument) result2 (fn2 result1) result3 (fn3 result2)] result3))
With this, I can bind
argument manually in the repl, and can apply
(fn1 argument), but successive steps become cumbersome (I would need to keep
def’ing the result of the previous step)
clj> (def argument "foo") clj> ;; evaluate fn1 clj> (fn1 argument) clj> ;; re-evaluate fn1 with changes clj> (fn1 argument) ;; etc
So I thought of putting everything in a
comment , without needing to define the intermediante functions:
(comment (def argument "foo") (-> argument XXXX YYYY) ;; => result1 )
This way I can easily go step by step of the transformation of the
argument into the result I want. Having finished this, I now have to “backport” everything into the initial
let of my main function, and the cycle repeats.
How could I improve this workflow?
Pardon my ignorance, and let me know if something is not clear