Figure out a way to splice in seq of arguments
dundalek opened this issue · 2 comments
dundalek commented
So that arguments can be spliced instead of using workarounds like this:
(eval `(sh-str git status ~@flags > "/dev/null" | tail -n1))
After it might become:
(apply sh-str* (concat ["git" "status"] flags '["/dev/null" | tail -n1]))
Now that I see it.. it looks ugly too. So there may be even some better way.
dundalek commented
Maybe use metadata?
(sh-str git status ^:splice flags > "/dev/null" | tail -n1)
jeroenvandijk commented
In my opinion the apply version isn't that ugly. Especially since we would use it in scripts only.
Also it can be made slightly less ugly:
(apply sh-str* "git" "status" (concat flags '["/dev/null" | tail -n1]))
This might be uglier then the metadata option, for instance, but it would be easier to understand and reason about when you already have some experience in Clojure.