Package alexandria
alexandria is a collection of portable public domain utilities.
About This PackageIntroduction Hash Tables Data and Control Flow Conses Sequences Macro Writing Symbols Arrays Types Conditions Numbers OverviewAuthorsNikodemus SiivolaAttila Lendvai Marco Baringer Robert Strandh Luis Oliveira Tobias C. Rittweiler VersionThis is the documentation of the library taken from the Git repository (see below). The last modification of the documented source code was done on 2012-04-26.Homepagehttp://common-lisp.net/project/alexandria/Mailing listshttp://lists.common-lisp.net/mailman/listinfo/alexandria-develhttp://lists.common-lisp.net/mailman/listinfo/alexandria-cvs Download and Source Codehttp://common-lisp.net/gitweb?p=projects/alexandria/alexandria.gitDocumentationThe draft version of the documentation is available athttp://common-lisp.net/project/alexandria/draft/alexandria.html. This documentation is based on the above version. The documentation has been generated with the library atdoc. Licensealexandria software and associated documentation are in the public domain:Authors dedicate this work to public domain, for the benefit of the public at large and to the detriment of the authors' heirs and successors. Authors intends this dedication to be an overt act of relinquishment in perpetuity of all present and future rights under copyright law, whether vested or contingent, in the work. Authors understands that such relinquishment of all rights includes the relinquishment of all rights to enforce (by lawsuit or otherwise) those copyrights in the work. Authors recognize that, once placed in the public domain, the work may be freely reproduced, distributed, transmitted, used, modified, built upon, or otherwise exploited by anyone for any purpose, commercial or non-commercial, and in any way, including by methods that have not yet been invented or conceived. In those legislations where public domain dedications are not recognized or possible, alexandria is distributed under the following terms and conditions: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Introductionalexandria is a project and a library.As a project alexandria's goal is to reduce duplication of effort and to improve portability of Common Lisp code according to its own idiosyncratic and rather conservative aesthetic. What this actually means is open to debate, but each project member has a veto on all project activities, so a degree of conservativism is inevitable. As a library alexandria is one of the means by which the project strives for its goals. alexandria is a collection of portable public domain utilities that meet the following constraints:
Hash TablesAcessor which ensures a value for a key in the hash table. ... Iterates over all keys in a hash table. ... Iterates over all values in a hash table. ... Returns a list containing the keys of the hash table table. ... Returns a list containing the values of the hash table table. ... Generates an association list from a hash table. ... Generates a property list from a hash table. ... Generates a hash table from an association list. ... Generates a hash table from a property list. ... Data and Control Flow Ensures that the global variable named by name is a constant with a value that is equal under test to the result of evaluating initial-value. ... The macro destructuring-case is a combination of the Common Lisp
macros case
and destructuring-bind. ... The macro destructuring-ccase is a combination of the Common Lisp
macros ccase
and destructuring-bind. ... Multiple-place modify macro for ensure-function. ...
Like the Common Lisp special operator multiple-value-prog1 but evaluates first-form, then second-form, and then forms. Yields as its value all the values returned by second-form. ... Expands into a lambda expression within whose body the argument name denotes the corresponding function. Evaluates form arguments one at a time, until the nth-value returned by one of the forms is true. It then returns all the values returned by evaluating that form. If none of the forms returns a true nth value, the return value is nil.
Creates new variable bindings, and conditionally executes either then-form or else-form. else-form defaults to nil. ... Creates new variable bindings, and conditionally executes forms. ... Creates new variable bindings, and conditionally executes forms. ... Evaluates the first matching clause, returning its values, or evaluates and returns the values of default if no keys match. Like switch, but signals a continuable error if no key matches. Like switch, but signals an error if no key matches. Evaluates exactly one of possibilities, chosen at random. The logical operation exclusive or. ... Returns a function that applies each of predicate and more-predicate functions in turn to its arguments, returning the
primary value of the first predicate that returns true, without calling the remaining predicates. If none of the predicates returns true, nil is returned. Returns a function that applies each of predicate and more-predicate functions in turn to its arguments, returning nil
if any of the predicates returns false, without calling the remaining
predicates. If none of the predicates returns false, returns the primary value of the last predicate. Returns a function composed of function and more-functions that
applies its arguments to to each in turn, starting from the rightmost of more-functions, and then calling the next one with the primary value of the last. Returns the function designated by function-designator. ... Returns a function composed of function and more-functions that
applies its arguments to each in turn, starting from the rightmost of more-functions, and then calling the next one with all the return values of the last. ConsesType designator for proper lists. Implemented as a satisfies
type, hence not recommended for performance intensive use. Main usefullness as a type designator of the expected type in a type-error . Type designator for circular lists. Implemented as a satisfies
type, so not recommended for performance intensive use. Main usefullness as a type designator of the expected type in a type-error . Modify macro for remove-from-plist. Modify macro for delete-from-plist. Modify-macro for reverse. Copies and reverses the list stored in the given place and saves back the result into place. Modify-macro for nreverse. Reverses the list stored in the given place by destructively modifying it and saves back the result into place. Modify-macro for union. Saves the union of list and the contents of place designated by the first argument to the designated place. Modify-macro for nunion. Saves the union of list and the contents of the place designated by the first argument to the designated place. May modify either argument. Iterates over elements of a property list. body can be preceded
by declarations, and is like a tagbody. return may be used to terminate the iteration early. If return is not used, returns values. Returns true if object is a circular list, nil otherwise. Returns true if object is a circular tree, nil otherwise. Returns true if object is a proper list. Returns a property list containing the same keys and values as the association list alist in the same order. Returns an association list containing the same keys and values as the property list plist in the same order. Creates a circular list of elements. Creates a circular list of length with the given initial-element. If thing is a cons, its car is returned. Otherwise thing is returned. If cons is a cons, it is returned. Otherwise returns a fresh cons with cons in the car, and nil in the cdr. If list is a list, it is returned. Otherwise returns the list designated by list. Traverses the tree in order, collecting non-null leaves into a list. Returns the last element of list. Signals a type-error if list is not a proper list. Returns length of list, signalling an error if it is not a proper list. Applies function to respective elements of each list, appending all the result lists to a single list. function must return a list. Returns a list containing the results of calling function with one argument from list, and one from each of more-lists for
each combination of arguments. In other words, returns the product of list and more-lists using function. ... Returns a propery list with same keys and values as plist, except that keys in the list designated by keys and values corresponding to them are removed. The returned property list may share structure with plist, but plist is not destructively modified. Keys are compared using eq. Just like remove-from-plist, but this version may destructively modify the provided plist. Returns true if every element of list1 matches some element of list2 and every element of list2 matches some element of list1. Otherwise returns false. Returns true if object is a list that denotes a set, nil
otherwise. A list denotes a set if each element of the list is unique under key and test. SequencesType designator for proper sequences, that is proper lists and sequences that are not lists. Modify-macro for delete. Sets place designated by the first argument to the result of calling delete with the arguments item, place, and remove-keywords. Modify-macro for remove. Sets place designated by the first argument to the result of calling remove with the arguments item, place, and remove-keywords. Returns a sequence of the same type as sequence, with the elements of sequence rotated by n. n elements are moved from the end of sequence to the front if n is positive, and -n elements moved from the front to the end if n is negative. ... Returns a random permutation of sequence bounded by start and end. The permuted sequence may share storage with the original one. Signals an error if sequence is not a proper sequence. Returns a random element from sequence bounded by start and end. Signals an error if sequence is not a proper sequence. Returns true if sequence is an empty sequence. Signals an error if sequence is not a sequence. Returns true if sequence is a sequence of length length. Signals an error if sequence is not a sequence. Returns false for circular lists. Takes any number of sequences or integers in any order. Returns true iff the length of all the sequences and the integers are equal. ... Returns the first element of sequence. Signals an error of type type-error if sequence is not a sequence, or is an empty sequence. ... Returns the last element of sequence. Signals an error of type type-error if sequence is not a proper sequence, or is an empty sequence. ... Returns true if sequence is a sequence whose first element is eql to object. Returns nil if sequence is not a
sequence or is an empty sequence. Test whether the first elements of sequence are the same (as per test) as the elements of prefix. ... Returns true if sequence is a sequence whose last element is eql to object. Returns nil if sequence is not a sequence or is an empty sequence. Signals an error if sequence is an
improper list. Test whether sequence ends with suffix. In other words: return true if the last (length suffix) elements of sequence are equal to suffix. Calls function with each combination of length constructable from the elements of the subsequence of sequence delimited by start and end. ... Calls function with each derangement of the subsequence of sequence denoted by the bounding index designators start and end. ... Calls function with each permutation of length constructable from the subsequence of sequence delimited by start and end. ... Macro Writing Evaluates forms with symbols specified in specs rebound
to temporary variables, ensuring that each initform is evaluated only once. ... Alias for with-gensyms. Returns t if the argument feature-expression matches the state of the *features* list and nil if it does not. ... Parses body into (values remaining-forms declarations doc-string). Documentation strings are recognized only if documentation is true. Syntax errors in body are signalled and whole is used in the signal arguments when given. Parses an ordinary lambda-list, returning as multiple values ... SymbolsConstructs a string by applying arguments to string designator control as if by format, and then creates a symbol named by that string. If package is nil, returns an uninterned symbol, if package is t, returns a symbol interned in the current package,
and otherwise returns a symbol interned in the package designated by package. Interns the string designated by name in the keyword package. If name is a non-negative integer, calls gensym using it. Otherwise name must be a string designator, in which case calls gensym using the designated string as the argument. Returns a list of length gensyms, each generated as if with a call to make-gensym, using the second (optional, defaulting to "G") argument. Concatenate together the names of some strings and symbols, producing a symbol in the current package. ArraysType designator for an index into array of length: an integer between 0
(inclusive) and length (exclusive). length defaults to array-dimension-limit. Type designator for a dimension of an array of length: an integer between 0
(inclusive) and length (inclusive). length defaults to array-dimension-limit. TypesA string designator type. A string designator is either a string, a symbol, or a character. Modify-macro for the Common Lisp function coerce. Returns a function of one argument, which returns true when its argument is of type. Returns a primary value of t if type1 and type2 are the
same type, and a secondary value that is true if the type equality could be reliably determined: primary value of nil and secondary value of t indicates that the types are not equivalent. ConditionsSignals an error for a missing argument of name. Intended for
use as an initialization form for structure and class-slots, and a default value for required keyword arguments. ... Similar to ignore-errors but the (unevaluated) conditions list determines which specific conditions are to be ignored. ... NumbersModify-macro for max. Sets place designated by the first argument to the maximum of its original value and numbers. ... Modify-macro for min. Sets place designated by the first argument to the minimum of its original value and numbers. ... Clamps the number into [min, max] range. Returns min if number is lesser then min and max if number is greater then max, otherwise returns number ... Returns the result of linear interpolation between a and b, using the interpolation coefficient v. ... Factorial of the non-negative integer n ... Subfactorial of the non-negative integer n. Returns two gaussian random double floats as the primary and secondary value, optionally constrained by min and max. Gaussian random numbers form a standard normal distribution around 0.0d0 ... Return a list of n numbers, starting from start (with numeric contagion from step applied), each consequtive number being the sum of the previous one and step. start defaults to 0 and step to 1. ... Calls function with n numbers, starting from start (with numeric contagion from step applied), each consequtive number being the sum of the previous one and step. start defaults to 0 and step to 1. Returns n. ... Variance of sample. Returns the biased variance if biased
is true (the default), and the unbiased estimator of variance if biased is false. sample must be a sequence of numbers. ... Standard deviation of a sample. ... | Exported Symbol Index |