if-exists - one of :error, :new-version, :rename,
:rename-and-delete, :overwrite, :append,
:supersede, or nil.
The default is :new-version if the version component of filespec is :newest,
or :error otherwise.

if-does-not-exist - one of :error, :create, or nil.
The default is :error if direction is :input
or if-exists is :overwrite or :append;
:create if direction is :output or :io,
and if-exists is neither :overwrite nor :append;
or nil when direction is :probe.

open creates, opens, and returns a file stream
that is connected to the file specified by filespec.
Filespec is the name of the file to be opened.
If the filespecdesignator is a stream,
that stream is not closed first or otherwise affected.

The keyword arguments to open specify the characteristics
of the file stream that is returned, and how to handle errors.

If direction is :input
or :probe,
or if if-exists is not :new-version
and the version component of the filespec is :newest,
then the file opened is that file already existing in the file system
that has a version greater than that of any other file in the file system
whose other pathname components are the same as those of filespec.

An implementation is required to recognize all of
the open keyword options
and to do something reasonable in the context of the host operating
system.
For example, if a file system does not support distinct file
versions and does not distinguish the notions of deletion and expunging,
:new-version might be treated the same as
:rename or :supersede, and :rename-and-delete might
be treated the same as :supersede.

:direction

These are the possible values for direction,
and how they affect the nature of the stream that is created:

Causes the creation of a "no-directional" file stream;
in effect, the file stream is created
and then closed prior to being returned by open.

:element-type

The element-type specifies the unit of transaction for the file stream.
If it is :default,
the unit is determined by file system,
possibly based on the file.

:if-exists

if-exists specifies the action to be taken if direction is
:output or :io and a file of the name filespec
already exists.
If direction is :input, not supplied, or :probe,
if-exists is ignored.
These are the results of open as modified by if-exists:

The existing file is renamed to some other name and then a new file is created.

:rename-and-delete

The existing file is renamed to some other name,
then it is deleted but not expunged, and then a new file is created.

:overwrite

Output operations on the stream destructively modify the existing file.
If direction is :io the file is opened in a bidirectional mode
that allows both reading and writing. The file pointer is initially
positioned at the beginning of the file; however, the file is not truncated
back to length zero when it is opened.

:append

Output operations on the stream destructively modify the existing file.
The file pointer is initially positioned at the end of the file.

If direction is :io,
the file is opened in a bidirectional mode that allows both reading and writing.

:supersede

The existing file is superseded;
that is, a new file with the same name as the old one is created.
If possible, the implementation should not destroy the old file until the new
stream is closed.

When a file is opened, a file stream is constructed to serve
as the file system's ambassador to the Lisp environment;
operations on the file stream are reflected by operations on the file
in the file system.

The various file systems in existence today have widely differing capabilities,
and some aspects of the file system are beyond the scope of this specification
to define. A given implementation might not be able to support all of these options
in exactly the manner stated. An implementation is required to recognize all of
these option keywords and to try to do something "reasonable" in the context of the
host file system. Where necessary to accomodate the file system,
an implementation deviate slightly from the semantics specified here without
being disqualified for consideration as a conforming implementation.
If it is utterly impossible for an implementation to handle some option
in a manner similar to what is specified here, it may simply signal an error.

With regard to the :element-type option, if a type is
requested that is not supported by the file system, a substitution of types
such as that which goes on in upgrading is permissible. As a minimum
requirement, it should be the case that opening an outputstream
to a file in a given element type and later opening
an inputstream to the same file in the same element type
should work compatibly.