Naming conventions

Some symbol naming conventions, distilled from CLHS, the Lisp FAQ, and comp.lang.lisp.

Widely used "need-to-know" conventions:

foo-bar "-" is used as a word delimiter *foo* (global) special variable foo* slightly different variant of the foo operator &foo lambda list keyword. These symbols will be in the lambda-list-keywords list. nfoo (possibly) destructive (non-consing) function foop predicate (also foo-p); see notes below for when to hyphenate foof place changing (like in SETF, INCF, ...) (also foo-f) +foo+ constant, or single CLOS instance %foo low-level, fast, dangerous function, or Lisp system specific implementation of foo make-foo create a foo and return it define-foo (globally) define a new foo (also short version: "deffoo") with-foo create a dynamic context with a foo do-foo iterate through a foo foo-case foo-specific case expression foo-bar type-slot, converting FOO to BAR foo-to-bar converting FOO to BAR

Often seen, but not-quite-so-common conventions:

bar-of slot bar of an object foo/bar type/operation, foo with bar, bar version of foo foo.bar type.slot or, in some implementations conventional hierarchical package (e.g. ACL and CMUCL) ?foo variable in embedded language <foo< variable in embedded language

Occasionally seen:

<foo> class %foo% local special variable .foo. internal special variable .foo. private macro symbol /foo/ global lexical variable $foo function visible from Macsyma foo& foo, operating on fixnums foo$ foo, operating on floats

Conventions in Scheme:

foo! destructive function foo? predicate $foo constant call-with-foo Invoke a thunk in some dynamic context foo->bar Coerce object of type foo to object of type bar

This is standard syntax, not convention:

:bar keyword foo:bar external symbol bar in package foo foo::bar internal symbol bar in package foo (don't try this at home, kids!) #:bar uninterned symbol (does not belong to any package)

These will annoy people:

CamelCaseIdentifiers Use identifiers-like-this identifiers_with_underscores are harder to type hungarian-identifiers-pcsnsi abbrv-idntfrs Use Emacs to expand them.

Unless there is a good reason to use them (for instance, you need to interface to a third-party package that uses them), they should be avoided.

Some additional style notes: