Ray, The question of what a form is is actually quite an important part of grasping Lisp/Clojure. Earlier versions of Lisp used the term S-expression (symbolic expression) extensively. But during the process of defining Common Lisp, the term was dropped in favor of the notion of forms. Stuart Shapiro wrote a Common Lisp book that you may find useful in studying Clojure as well: http://www.cse.buffalo.edu/~shapiro/Commonlisp/
In the book’s preface he defines these two terms: S-expression - syntactic units, sequences of characters that form the written version of Lisp programs and data structures. Form - a Common Lisp object that can be evaluated In terms of the REPL (read-eval-print loop), an S-expression is the input to the reader, and a form is the output of the reader, which then becomes the input to eval. An S-expression is syntax. A form is some sort of representation in memory. So a simple rule of thumb is that S-expressions in Lisp often contain parentheses, but there are no parentheses in forms. Here are a couple more formal definitions, again from a Common Lisp perspective: http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_f.htm#form form n. 1. any object meant to be evaluated. 2. a symbol, a compound form, or a self-evaluating object. 3. (for an operator, as in ``<<operator>> form'') a compound formhaving that operator as its first element. ``A quote form is a constant form.’' A self-evaluating object would be something like a numeric literal: 2.4 or a string “Yo!”. Compound forms are further defined: http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_c.htm#compound_form compound form n. a non-empty list which is a form: a special form, a lambda form, a macro form, or a function form. Remember that these Common Lisp definitions don’t line up exactly with Clojure, but they are illuminating. Have all good days, David Sletten On Dec 28, 2015, at 11:16 AM, Ray Toal <ray.t...@gmail.com> wrote: > I think of it this way too but was really trying to get a formal definition, > if one exists. > > While I've not seen a formal grammar of Clojure anywhere, I have looked at > > > https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java > > which seems to show that forms can be a lot of things, including > READ_FINISHED and READ_EOF, which probably aren't intended for public > consumption. :) > > The actual read() function (or method, as this is all written in Java), > looked promising but was hard to decipher. > > Maybe the term is intentionally vague? I was hoping it wasn't. But the fact > that it is hard to find a hard definition of it makes me wonder. > > Thanks > > > On Monday, December 28, 2015 at 5:08:36 AM UTC-8, Gregg Reynolds wrote: > > On Dec 28, 2015 6:58 AM, "Ray Toal" <ray....@gmail.com> 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? > > A syntactic unit, as opposed to a lexical unit? Left paren is a lexical > unit, to "read it you have to find the following balanced right paren, and if > everything in between is syntactically correct you have a list form. At > least that's how I think of it. > > Gregg > > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > 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 clojure+unsubscr...@googlegroups.com. > 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 clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.