A form is a complete piece of data the reader can consume. So "1", "a", "[x y]" and "(foo (bar baz))" are all forms, since they can be read as complete (unevaluated) data structures.
On the other hand, "(foo" is not a form as it is not complete, and "(foo) (bar)" is two forms, because each part is complete and discrete. - James On 28 December 2015 at 06:29, Ray Toal <[email protected]> wrote: > Throughout the Clojure documentation there are many references to *forms*. > > I know about special forms, macros, vars, symbols, keywords, integers, > doubles, ratios, sets, maps, lists, vectors, booleans, nil, etc. > > What exactly, though, is a form? The documentation for the reader says: > > One might say the reader has syntax defined in terms of characters, and > the Clojure language has syntax defined in terms of symbols, lists, > vectors, maps etc. The reader is represented by the function read > <http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/read>, > which reads the next form (not character) from a stream, and returns the > object represented by that form. > > > This is fine, but what exactly is the "next form" referred to here? If the > next available character in the stream is a left paren whose closing right > paren is all the way at the end of the stream, is the next form read the > whole stream? If so, does it not also read all of the nested forms? > > I've not been able to find a precise definition of a form, so any pointers > will be appreciated! > > Thanks > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
