Re: What exactly is a form in Clojure?

2015-12-28 Thread Gregg Reynolds
On Dec 28, 2015 6:58 AM, "Ray Toal" 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,

Re: What exactly is a form in Clojure?

2015-12-28 Thread James Reeves
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

What exactly is a form in Clojure?

2015-12-28 Thread Ray Toal
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

Re: What exactly is a form in Clojure?

2015-12-28 Thread Timothy Baldridge
So this will not be a very formal definition of "form", but I will do my best. A "form" is a fully contained "thing". So yes 1 is a form, so is "1", and ["1" 2] and (quote (foo bar)), and {:foo :bar}. You are right in assuming that reading a ( will cause the reader to read to the matching ). This

Re: What exactly is a form in Clojure?

2015-12-28 Thread Ray Toal
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

Re: What exactly is a form in Clojure?

2015-12-28 Thread Gregg Reynolds
On Dec 28, 2015 11:16 AM, "Ray Toal" wrote: > > I think of it this way too but was really trying to get a formal definition, if one exists. I suspect you'll need to look outside of programming languages. I believe it goes back to Hilbert's doomed project of purely formal

Re: What exactly is a form in Clojure?

2015-12-28 Thread Ray Toal
Beautiful, exactly what I was looking for. Thanks for the explanations and the links. On Monday, December 28, 2015 at 12:11:46 PM UTC-8, slytobias wrote: > > Ray, > > The question of what a form is is actually quite an important part of > grasping Lisp/Clojure. Earlier versions of Lisp used the

Re: What exactly is a form in Clojure?

2015-12-28 Thread David Sletten
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