On 31 May 2010, at 09:35, alux wrote:

I got a very basic question about the concept of "special form". What
is correct, multiple selections allowed:

[  ] A special form is what can be implemented by a macro.

Wrong. You cannot implement a Lisp-like language with just macros and functions. At some point the operations defined by macros and functions must be reduced to fundamental operations that are handled directly by the compiler.

Example: if and cond. You can implement either one in terms of the other one as a macro, but you cannot implement *both* as macros.

[  ] Every macro gives a special form.

Wrong. A macro rewrites a form to another form. A special form is interpreted directly by the compiler.

There is also a technical difference: a macro is the value of a name, which is looked up in the context of the macro call. Constructs like macrolet (clojure.contrib.macro-utils) permit local macro definitions, for example. A special form is named by a symbol whose interpretation cannot be overridden in any way.

[  ] Only a macro that doesn't evaluate some of its arguments gives a
special form.

Wrong as well. The distinction between macros and special forms is a matter of implementation, not of evaluating arguments.

[  ] A special form is always built in, and cannot be implemented in
the language itself.

True for a minimalist language implementation. An implementation may choose to use more special forms than strictly necessary for performance reasons.

[  ] The concept of special form doesnt have anything to do with
eagerness or lazyness.

True.

Konrad.

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