In page 19 of Pratical Clojure by Luke VanderHart & Stuart Sierra,
Chapter 2, there is a paragraph,

Special forms definition : Special forms are a particular type of
composite form. For most purposes, they are used very similarly to a
function call. The difference is that the first form of a special form
is not a function defined somewhere, but a special system form that’s
built into Clojure.

1st question,
Is the form word is a typo here? Isn't the word will be item? If not,
is def a form? That means, this code contains 3 forms. :-s

Cause later on, when the write was explaining an example, he used
item.

(def message "Hello, World!")

Analyzing the first form, (def message "Hello, World!") , you see
first that it is enclosed in parenthesis. Therefore, it is a list, and
will be evaluated as a function application or a special form. There
are three items in the list: def, message and "Hello, World!". The
first item on the list, def, will be the function or special form that
is called. In this case, it's a special form. But like a function, it
takes two parameters—the var to define, and the value to which to bind
it. Evaluating this form creates a var which establishes a binding of
the value "Hello, World!" to the symbol message.

2nd question,
Is a composite form is a special form only when, the first item of a
list is something that is only predefined withing Clojure? If yes,
then is it possible to create custom special form? Is then the custom
composite form is gonna be called as a special form? Cause, according
to the definition, my custom is not something built in clojure, it is
defined somewhere else?

EDIT: I guess the answer to my first question is no, its not a typo.
def IS a form.

cause later on the write said,

The second form (println message) is also a list and this time it’s a
normal function application. It has two component forms—each of them
is a symbol
That means, (println message) > the whole thing is a form, and every
thing else(function arguments) that it holds is also a form.

But, at the beginning the writer said, there are four basic varieties
of forms.

1. Literal,
2. Symbol,
3. Composite form and
4. Special form.

According to the definition of Symbols from the book, its not a
symbol.

Symbol Definition: Symbols are forms which resolve to a value. They
may be thought of as roughly similar to variables, although this is
not technically accurate since they are not actually variable in the
same way variables in most languages are. In Clojure, symbols are used
to identify function arguments, and globally or locally defined
values. Symbols and their resolution are discussed in more detail in
the following sections. Cause, writing def and pressing return key
produces the following error message,

In which category, def falls into?

-- 
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

Reply via email to