# Clojure
Hosted Language on top of Java (JVM)
'
ignore evaluating the next thing- Runtime Polymorphism. same operaton for all type of collections
- commas in clojure are just whitespace
- Referential transparency
- Functions are values in clojure
- Multi-arity
let
bind arguments to operators and then return a value- Loops are recursion in FP language, we dont do mutations
- Higher order functions, map, reduce, filter
::
Fully qualified keyword- Destructuring - pull oout values from a DS
# Data structures
- vector vs lists
- both are implemented as linked lists in java
- difference is one is stack, other one is queue
- Sets
- Maps and Hash Functions
Function | operator namespace |
---|---|
get a value | get, get-in |
add a kv | assoc, assoc-in |
remove | dissoc |
# State Management
atom, ref, agent
# atom
- reset! - replace the eitire ref
- deref - get the value
- swap! - state, function, return value
# What can clojure do
- Scraping web pages
- Shell scripts
- Building websites
- Playing around with OpenGL
- Writing async webservers
- HTML Templating
- Running parallel tasks (fetching multiple URLs and process in parallel)
- Playing around with real time audio
- Simulations