To play with ClojureScript without installing anything use the online REPL.
Install OpenJDK brew cask install adoptopenjdk
Install a Clojure build tool, Leiningen with brew install leiningen for mac. Then start a
new project with:
lein new app my-demo
cd my-demo
lein run # runs the app
lein repl # start replAlternatively, install Clojure
tooling with
brew install clojure/tools/clojure
and follow guide simple apps
Best and easiest editor to use is VSCode with Calva
- Start with the intro.clj language demonstration
- Then check out the web demo with Re-Frame
John McCarthy developed Lisp in 1958 and is the second-oldest high-level programming language in widespread use today. Only Fortran is older, by one year. Lisp has changed since its early days, and many dialects have existed over its history. Today, the best-known general-purpose Lisp dialects are Clojure, Common Lisp, Scheme, and emacs lisp (elisp).
Lisp was originally created as a practical mathematical notation for computer programs, influenced by the notation of lambda calculus. It quickly became the favored programming language for artificial intelligence (AI) research.
Lisp programs can manipulate source code as a data structure, giving rise to the macro systems that allow programmers to create new syntax or new domain-specific languages embedded in Lisp.
Program code is written as s-expressions, or
parenthesized lists. For instance, a function f that takes three arguments
would be called as (f arg1 arg2 arg3)
Clojure designed by Rich Hickey in 2007. Clojure is a functional language with a dynamic emphasis.
- All data structures immutable & persistent, supporting recursion.
- Not OS dependent, runs on many virtual machines (JVM, NodeJS, CLR, Erlang, Graal). "Hosted language"
- Bytecode + JIT compilation on JVM/AdoptOpenJDK
- Designed for Concurrency, Read about state. Immutability makes much of the problem go away.
- OOP overrated, adds incidental complexity (aka, "complecting") and not focusing on business logic. Mutable stateful objects are the new spaghetti code - concurrency nightmare.
- OOP has imperative programming baked into it. There is no way to observe a stable state (even to copy it) without blocking others from changing it. OOP understands the true notion of a value, say, 42, as something that would never change, but usually don’t extend that notion of value to their object’s state.
- In Clojure’s model, value calculation is purely functional. Values never change.
- "It is better to have 100 functions operate on one data structure than to have 10 functions operate on 10 data structures." - Alan J. Perlis
- Rich Hickey's Greatest Hits Videos - Simple Made Easy being most iconic.
- ClojureScript cheatsheet
- VSCode Calva
- Awesome Clojure Curated list of libraries
- HTML with Hiccup, Syntax
- CSS with Garden
- Graal interop with R and Python
- libpython-clj Interop, PyPlot Tutorial, NLP with Python interop
- honeySQL, Korma SQL and Toucan, ORM like