Code Observation: Clojure's Destructuring

submited by
Style Pass
2021-06-14 11:30:04

Clojure's destructuring helps us establish bindings to items in Clojure collections in a concise, intuitive way if we already understand how to use Clojure's data structures and core functions that work with them.

Here, concise means that destructuring employs fewer expressions than would be required using only Clojure's core functions for retrieving parts of data structures.

Here, intuitive means that Clojure's implementation and our own intuition are aligned. If they are not now, they should be by the experiment's end.

Environment details:Clojure: Version 1.10.3JDK: OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.10, mixed mode, sharing)System: Linux 5.11.0-18-generic #19-Ubuntu SMP Fri May 7 14:22:03 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Evaluation results are collapsed by default. You're encouraged to run the examples at your own REPL or mentally determine the outcomes before peeking.

Leave a Comment