Skip to content

Instantly share code, notes, and snippets.

Alexander Stavonin astavonin

Block or report user

Report or block astavonin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Integralist / Let
Last active Apr 24, 2019
Clojure destructuring using `let` (which allows local storage inside of a function, we would say a local "variable" but that would be misleading because all data is immutable in Clojure)
View Let

In Clojure you can apply destructuring within either a let binding list; function parameter list or even a macro.

A simple example would be:

(def coords [5 7]) ; define a symbol "coords" that points to a vector [5 7]
(let [[x y] coords] (println "x:" x "y:" y))
; => x: 5 y: 7
You can’t perform that action at this time.