ToC DocOverview CGDoc RelNotes Index PermutedIndex
Allegro CL
Home Previous Up Next Table of Contents Index
  ANSI Common Lisp   11 Packages   11.2 Dictionary of Packages

11.2.21 intern Function

Syntax:
intern string &optional package    symbol, status

Arguments and Values:
string - a string.

package - a package designator. The default is the current package.

symbol - a symbol.

status - one of :inherited, :external, :internal, or nil.

Description:
intern enters a symbol named string into package. If a symbol whose name is the same as string is already accessible in package, it is returned. If no such symbol is accessible in package, a new symbol with the given name is created and entered into package as an internal symbol, or as an external symbol if the package is the keyword package; package becomes the home package of the created symbol.

The first value returned by intern, symbol, is the symbol that was found or created. The meaning of the secondary value, status, is as follows:

Examples:
 (in-package "COMMON-LISP-USER")  #<PACKAGE "COMMON-LISP-USER">
 (intern "Never-Before")  |Never-Before|, NIL
 (intern "Never-Before")  |Never-Before|, :INTERNAL 
 (intern "NEVER-BEFORE" "KEYWORD")  :NEVER-BEFORE, NIL
 (intern "NEVER-BEFORE" "KEYWORD")  :NEVER-BEFORE, :EXTERNAL

See Also:
find-symbol, read, symbol, unintern, Section 2.3.4 Symbols as Tokens

Notes:
intern does not need to do any name conflict checking because it never creates a new symbol if there is already an accessible symbol with the name given.

Allegro CL Implementation Details:
Allegro CL allows symbols as well as strings as the first argument.. See Extensions to cl:intern in implementation.htm. Note that link is to the documentation for the current Allegro CL version. Replace /current/ in the URL with the Allegro CL version number to see similar documentation is earlier releases.

Home Previous Up Next Table of Contents Index
© Franz Inc. 1998-2015 - File last updated 03-23-2015