Programs, Scripts, Pods, and Libs Babashka can be launched for interactive programming (REPL)
bb --nrepl-server bb --socket-server
int, double Vectors, Lists, Sets and Maps(Dictionaries) Strings, RegExp
(doseq [n (range 5)]
(println (str "Line " n)))
(take 5 (repeat "Hello"))
(zipmap [:score :hits :friends :level :energy :boost] (repeat 0))
;; repeatedly to generate a sequence of vals
(take 10 (repeatedly (partial rand-int 100)))
Iterate
;; simple
(take 3 (iterate inc 5))
;; slightly complex
(defn savings [principal yearly-rate]
(let [monthly-rate (+ 1 (/ yearly-rate 12))]
(iterate (fn [p] (* p monthly-rate)) principal)))
(take 13 (savings 1000 0.01))
(take 5 (cycle ["a" "b"]))