; Comments start with a semicolon.
; Anything after the semicolon is ignored.
nil ; also known in other languages as null
; Booleans
true
false
; 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.
:time
:machine
:time-machine
; Symbols are used to represent identifiers.
; You can namespace symbols by using /. Whatever precedes / is
; the namespace of the symbol.
spoon
kitchen/spoon ; not the same as spoon
kitchen/fork
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
42
3.14159
; 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 https://learnxinyminutes.com/docs/edn/
; License https://creativecommons.org/licenses/by-sa/3.0/deed.en_US
; © 2019 Jason Yeo, Jonathan D Johnston