Created
September 24, 2019 21:06
-
-
Save joinr/bed4cb86a7590abd4519417b426f6ad7 to your computer and use it in GitHub Desktop.
a demonstration of how trivial it is to splice things in clojure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`[~(range 10) ~[:this :vector :is] ~{:brought "to" :you "by"} ~@[:splicing :vectors] | |
~#{:sets} :and ~@'(:lists :together) :somewhat :trivially | |
~@{:even {:nested [:vectors]} :and [:maps :of :stuff] :are :easy} #{~@[:so :are :sets]} | |
~(eval `[:its :even [:easy ~@[:to :splice :quoted :forms] | |
~{:of :varying :levels #{:of-depth}}]])] | |
;;yields | |
[(0 1 2 3 4 5 6 7 8 9) | |
[:this :vector :is] | |
{:brought "to", :you "by"} | |
:splicing | |
:vectors | |
#{:sets} | |
:and | |
:lists | |
:together | |
:somewhat | |
:trivially | |
[:even {:nested [:vectors]}] | |
[:and [:maps :of :stuff]] | |
[:are :easy] | |
#{:so :are :sets} | |
[:its | |
:even | |
[:easy :to :splice :quoted :forms {:of :varying, :levels #{:of-depth}}]]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment