A parameter after & collects extra arguments into a sequence. Here those arguments are joined by a separator. Calling the function with no extra arguments yields an empty sequence.
&
(require '[clojure.string :as string]) (defn join-with [sep & parts] (string/join sep parts)) (println (join-with "-" "a" "b" "c")) (println (pr-str (join-with ", ")))
pr-str shows the empty string with quotes.
pr-str
$ glj variadic-functions.glj a-b-c ""
Next example: Closures.
A hands-on tour in the style of Go by Example. Glojure is a Clojure interpreter hosted on Go.