 metadata is data that annotates other data. All closure objects, except numbers, booleans, and strings can have an associated map of metadata. Metadata is used by a few special forms and standard library macros, and sometimes you'll find attaching metadata to objects useful for your own purposes. We can create a new object with metadata using the withMeta function of closure.core. This call to withMeta returns a new vector with the values 1 and 2, and this new vector has a metadata map with the key soMeta associated with the value true. To get the metadata map of an object we use the meta function of closure.core. Another way to attach metadata is with the special character carrot. When a map is preceded with a carrot character the reader will attach it as metadata to the following reader element. So the map here is not its own reader element, rather this syntax produces one reader element the vector, and that vector has the map attached to it as its metadata. Some special forms and macros treat elements with metadata in special ways. The def special form, for example, will attach the metadata of its symbol to the var of the def. So when this def form maps a symbol x to a var it attaches a metadata of the symbol to the var itself. The last thing to understand about metadata is it closure's equality test ignores metadata. This equality test returns true because the two vectors are equivalent even though they have different metadata. The term arity refers to the number of arguments expected by a function. Closure functions can actually have multiple bodies as long as each body has a distinguishable arity. Each parameter list and body is written in parentheses. This function here foo has two arities. When called with three arguments it returns the sum of its arguments, but when called with two arguments it returns the second argument subtracted from the first. An important limitation is that no two bodies of the function may expect the same number of arguments. This fn form here will trigger an evaluation error because its two bodies both expect the same number of arguments which would make calls to the function ambiguous. Does a call with three arguments invoke the first definition or the second? There's no way for closure to decide so it doesn't allow such functions. Also be clear that a rest parameter causes conflicts with any function definition that has an arity of greater length. In this example the second body expects one or more arguments so it conflicts with the first body expecting three arguments because three counts as one or more. The intimidating term destructuring simply refers to a convenience of the forms that create bindings namely let loop an fn. Very commonly we wish to bind the individual elements of a collection to separate symbols. For example here I'm binding the first element of the sequence to the symbol x and binding the second element to the symbol y. With destructuring I can express the same thing more concisely. Normally in a binding the target is a single symbol but here the target of the binding is a vector with two symbols x and y. The value of the expression we are binding is expected to mirror this vector such that the first element of s is bound to x and the second element is bound to y. As long as s is a seekable type this works fine. The sequence could even have fewer than two elements in which case the extra symbols get the value nil. Destructuring also works with maps. Here the target map has a key symbol x with value keyword x meaning that the value of the keyword x in the expression we're binding is bound to the symbol x. Frankly the syntax for map destructuring seems totally backwards to me. It would be much more logical to make the binding targets the values of the destructuring map instead of its keys. The reason closure went with the illogical syntax is because certain keywords used as keys of a destructuring map have special meaning in that context. For example the keyword keys in the destructuring map precedes a vector that lists symbols to bind for keywords of the same name, e.g. the symbol x is bound the value of the keyword x from the provided expression. So this special syntax bears us from having to write the same words as both symbols and keywords. There are a few other special keywords in destructuring maps but I won't go into them here. Destructuring maps and vectors can be nested. Here for example the target of the binding form is a map with a nested vector. The general idea of destructuring is that the provided expression must mirror the target as it does here. The value of the keyword x is expected to be a sequence and its first two elements are bound to the symbols a and b. While the syntax is nice and compact as you can see it gets a little cluttery so I recommend using it with some caution. All the examples I've shown are with the let form but destructuring also works in the loop and fn forms as well as the defend macro. In this defend macro for example the function expects just one parameter but that parameter is expected to be a seekable and the first and second elements of that seekable get bounded to the symbols a and b. A set is a collection type in which all of the elements are always unique. Sets are like maps but all the keys of a set are their own values whereas maps have key value pairs sets just have keys. Clojure has two primary kinds of sets hash sets and tree sets. The difference is that hash sets have no sense of order among their elements but tree sets keep their elements in a sorted order. The hash set function of closure.core creates a hash set. This example creates a set of three elements the string high the number five and the number eight. Notice that we supplied the value eight twice as argument to hash set but the set only stores one value eight not two. Many of the standard collection functions work on sets for example conge here returns a set of four elements high 11 5 8 get s high returns high and get s 24 returns nil because the set does not contain 24. Somewhat surprisingly we cannot remove elements with this oak but instead must use a function called disj short for disjoint. So this call to disjoint here returns a copy of the set but without the value five. To create a tree set we use the function sorted set. First we def to s a tree set with the values negative five two seven and nine in that order and if we call first on this set we get the value negative five and then rest returns the sequence two seven and nine. The sorting is done by the compare function so all of the elements must be numbers. If you want to specify a different sorting function use sorted set by. Here we use greater than as the compare function. You may recall from earlier that the greater than function sorts numbers from greatest to least because it returns true when its first argument is greater than its second. For convenience and concision closure collection types are themselves functions a collection invoked as a function returns the value for the index or key provided as argument. We invoke a vector as a function with the argument one and the call returns five the value at index one of the vector. Here we invoke a map as a function with the argument keyword y and the call returns four the value associated with the keyword y. As a further convenience keywords can also be called as functions. A keyword called as a function with a map as argument returns the value of the map associated with the keyword. This extra allowance does nothing we couldn't already accomplish but you may prefer this construction stylistically in certain contexts. In addition to the apostrophe for the quote form the closure reader has a few other syntactical conveniences. A list preceded with a number sign is shorthand for an f-n form whose body has just one expression. In these shorthand functions parameters are symbols starting with a percent sign followed by a number denoting the position of the parameter. For example here percent sign two denotes the second parameter and percent sign one denotes the first parameter. Percent sign by itself is the same as percent sign one. A number sign in front of curly braces is shorthand for a hash set. Somewhat strangely this set shorthand doesn't accept duplicate arguments. Like quote the var special form has a shorthand syntax number sign apostrophe. When the carat symbol precedes a symbol it is shorthand for a metadata map in which the symbol is associated with the keyword tag. As we'll discuss later the keyword tag in metadata maps is used by some special forms and macros to convey type information. When the carat symbol precedes a keyword it is shorthand for a metadata map in which the value true is associated with that keyword. Again this is convenient for certain special forms and macros which expect metadata maps of this form. That covers most of the syntactical conveniences but there are a couple more we'll mention later.