Essential EDN

edn (Extensible Data Notation)

; Comments start with a semicolon.
; Anything after the semicolon is ignored.

nil         ; also known in other languages as null

; Booleans

; Strings are enclosed in double quotes
"time travel is fun"
"time traveller's fun"

; Keywords start with a colon. They behave like enums. Kind of
; like symbols in Ruby.

; Symbols are used to represent identifiers.
; You can namespace symbols by using /. Whatever precedes / is
; the namespace of the symbol.
kitchen/spoon ; not the same as spoon
github/fork   ; you can't eat with this

; Underscore is a valid symbol identifier that has a special
; meaning in Crux Datalog where it is treated like a wildcard
; that prevents binding/unification. These are called "blanks".

; Integers and floats

; Lists are sequences of values
(:widget :sprocket 9 "some text!")

; Vectors allow random access. Kind of like arrays in JavaScript.
[:first 1 2 :fourth]

; Maps are associative data structures that associate the key with its value
{:avocado     2
 :pepper      1
 :lemon-juice 3.5}

; You may use commas for readability. They are treated as whitespace.
{:avocado 2, :pepper 1, :lemon-juice 3.5}

; Sets are collections that contain unique elements.
#{:a :b 88 "huat"}

; Quoting is used by languages to prevent evaluation of an edn data
; structure. In Clojure the apostrophe is used as the short-hand for
; quoting and it enables you to easily construct complex Crux queries.
; Without the apostrophes inside this map, Clojure would expect `a`,
; `b`, and `c` to be valid symbols.
{:find '[a b c]
 :where [['a 'b 'c]]}

; Adapted from
; License
; © 2019 Jason Yeo, Jonathan D Johnston

For further information on EDN, see Official EDN Format