Skip to content

Instantly share code, notes, and snippets.

View nchapon's full-sized avatar

Nicolas Chapon nchapon

View GitHub Profile
;; nchapon's solution to Count a Sequence
;; https://4clojure.com/problem/22
#(loop [coll % acc 0] (if (nil? (first coll)) acc (recur (rest coll) (inc acc))))
;; nchapon's solution to A nil key
;; https://4clojure.com/problem/134
#(nil? (%1 %2 "empty"))
@john2x
john2x / 00_destructuring.md
Last active August 23, 2024 07:45
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences