On May 16, 2007, at 11:20 AM, Martin Rubey wrote:
A quick overview of the common conventions (and some not so common ones) can be found at http://www.cliki.net/Naming%20conventions.Ralf Hemmecke <[EMAIL PROTECTED]> writes:see <http://planet.lisp.org>I think that won't help me much. But could someone tell me about a fewconventions used in naming identifiers.
Or (defparameter *foo* ...). There is a subtle difference, which you probably don't care for, unless you develop your Lisp in an interactive way, which is somewhat difficult with the Axiom sources.I already know that |blah| keeps blah from being capitalized, but are the barspart of the identifier?no.When do people use identifiers that are surrounded by *, for example *default-pathname-defaults*.*this-is-a-special-variable* The stars are only a convention, as you noticed already.A special variable is dynamically scoped - as opposed to the usual lexical scoping in lisp. It is introduced via (defvar *this-is-a-special- variable*)
This isn't quite correct. A symbol that starts with a colon is always interned in the KEYWORD package, rather than the current package. Keyword symbols are used for keyword arguments in functions:Think of a special variable as a global variable.What about a colon in front of an identifier? For example, (array-element-type (make-array 10 :element-type 'character))As far as I know this is also a convention, namely for keyword arguments.
(defun foo (bar &key baz (bam 3)) ...) (foo 3 :bam 7 :baz 9)You couldn't write (foo 3 bam 7 baz 9) instead, hence it is not a convention in this case.
Keyword symbols are also often used (this is by convention) for things like
(defun find-extremum (list max-or-min) ...) (find-extremum '(1 2 3 4 5) :max)Finally keyword symbols are often used in DSLs, like this example from cl-who (http://weitz.de/cl-who/):
(with-html-output (*http-stream*)
(:html
(:head (:title "My Homepage"))
(:body (:h1 "hello world"))))
Kai
_______________________________________________
Axiom-developer mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-developer
