Skip to content

cswaroop/automate-with-babashka

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Automate the boring stuff with Babashka

Clojure Programming Basics

Babashka Basics

Programs, Scripts, Pods, and Libs Babashka can be launched for interactive programming (REPL)

bb --nrepl-server
bb --socket-server

Data Structures

int, double Vectors, Lists, Sets and Maps(Dictionaries) Strings, RegExp

Flow Control

if(When), While

Map, Reduce

doseq, dotimes

(doseq [n (range 5)]
  (println (str "Line " n)))

repeat, iterate, cycle

(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"]))

For

Loop/Recur

Lazy sequences and doall

Functions

Metaprogramming with Macros

Parallel and Concurrent programming

Data parallel with pmap

Distributed Programming

Automating Tasks

Pattern Matching with RegExp

Input Validation

Organizing Files

Web Scraping

Working with Excel

Working with Google Sheets

Working with PDF and Word Documents

Working with CSV and JSON

Keeping time, Scheduling Tasks, and Launching programs

Sending Email and Text Messages

Manipulating Images

VIdeo Editing with ffmpeg

GUI Automation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published