FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
Unrevised from 8.2 to 9.0.
8.2 version

gensym-sequential-name

Arguments: start-name &key hyphenate package

Creates and returns a unique symbol in the specified package, based on the printed representation of start-name. This is useful for generating unique symbol names for objects.

Basically, gensym-sequential-name takes the print name of start-name, removes any numerals and hyphens from the end, optionally appends a hyphen, appends the string representation of the lowest positive integer that has not yet been used with the print name of start-name and that causes the completed string to not name an existing symbol after the string's case has been changed as appropriate for the *current-case-mode*, interns the string in the specified package, and returns the resulting symbol.

start-name may be any object, but is typically a symbol (which may have been created by gensym-sequential-name as well) or a string.

If hyphenate is specified, then a hyphen is appended before the number if and only if hyphenate is true. If hyphenate is not specified, then a hyphen is appended if and only if there are any other hyphens in the base string (after all numerals and hyphens have been removed from the end).

package may be either a package object or the name of a package. The default value is :keyword.

Examples (in a fresh lisp):

(gensym-sequential-name 'foo) returns :foo1
(gensym-sequential-name 'foo) returns :foo2
(gensym-sequential-name :foo1) returns :foo3
(gensym-sequential-name :foo-bar) returns :foo-bar-1
(gensym-sequential-name :foo-bar-1) returns :foo-bar-2
(gensym-sequential-name :baz :hyphenate t) returns :baz-1
(gensym-sequential-name :baz :hyphenate t :package 'common-lisp-user)
    returns common-lisp-user::baz-2

Copyright (c) 1998-2012, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 9.0. This page was not revised from the 8.2 page.
Created 2012.5.30.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
Unrevised from 8.2 to 9.0.
8.2 version