Next: Package FL.MACROS, Previous: Reference manual, Up: Reference manual [Contents][Index]
This package contains generally useful utility functions. Several of those functions were taken from (Graham 1996), the SANS function was contributed to the comp.lang.lisp newsgroup by Erik Naggum.
Add a hook with name hook-name to the hooks for function-name.
Calls func on all element tuples of the array arguments.
Make the property list supplied in items into a blackboard. Copies items to make sure that no literal list is modified.
A blackboard where data items can be put and extracted using the
function GETBB
.
Direct slots:
Boxes an object.
Call all hooks defined for function-name on object and returns object.
Checks if all of the properties are in the property list place.
Returns the speed which should be characteristic for the setting determined by memory-weight. If this argument is 0.0 it means that all operations should be inside cache memory whereas 1.0 means that the operation are restricted by memory bandwidth available.
Returns the composition of functions.
Composes two function objects f and g.
Documents a certain concept.
Returns a uniform constant vector of which all elements are value.
Copy hash-table.
Initializes the slots named in slots from obj2 to obj1. Returns obj1.
Supplies args to func from the left.
Pops an object from queue. Returns as second value T if the queue was empty.
Clears queue and returns content as a list.
Display hash-table in the form key1 -> value1 ...
Inserts obj in dll. It returns the newly created
dll-item
.
Inserts obj in dll. It returns the newly created
dll-item
.
Loops through hash-table. If looping-var is an atom key, loop through the keys; if it is a list of the form (value) loop through the values; if it is a list of the form (key value) loop through key and value.
Loops through each tuple below limits.
Tests if queue is empty.
Puts object into the queue.
Generic evaluation of functions on an argument. Numbers and arrays are treated as constants. Special evaluation is defined for multivariate polynomials on vectors and for <function> objects.
Compute the factorial of n. n can also be a list of numbers in which case the product of the factorials of the components is computed.
If the manual is sorted by file, the string handed to this function describes the use of the respective file.
The positive REMOVE - i.e. like REMOVE with :test instead of :test-not.
The positive version of REMOVE-IF-NOT.
Finds atom in tree.
Finds a leaf in tree where test returns true.
Finds a leaf in tree where test returns true.
Checks if list is a singleton and returns its first element.
Returns a FIXNUM-VEC
constructed from the parameters.
Vector with elements of type fixnum
.
Flatten a tree. Example:
(flatten '((1 2) (3) ((4)))) ⇒ (1 2 3 4)
Applies func to each element of collection.
Calls func on each tuple greater or equal to (0 ... 0) and below dims.
Gets property for object. Returns NIL also if property is not available.
An analog to GETF
for association lists.
An analog to (SETF GETF)
for association lists.
Get the item for key from blackboard. If there is no such key return default.
Groups elements in the sequence seq according to characteristic which is a function of one argument. Example:
(group-by #'second '((1 2) (2 2) (3 4) (4 4)))
Collect the keys of hash-table into a list.
Collect the values of hash-table into a list.
Checks if the permutation is the identity.
Returns an iterator for x.
Returns an incremented iterator.
Returns all subsets of set with length between k and l. Example:
(k->l-subsets '(1 2 3) 1 2) ⇒ ((1) (2) (3) (1 2) (1 3) (2 3))
Returns all subsets of set with length k. Example:
(k-subsets '(1 2 3) 2) ⇒ ((1 2) (1 3) (2 3))
Transforms list to a queue.
Iterates body over items. Example:
(let ((x (make-array 10)) (y (make-list 10 :initial-element 1))) (loop+ ((xc x) (yc y) i) doing (setf xc (+ i yc)) finally (return x)))
Generate an analogous but empty data structure.
Construct a FIXNUM-VEC
of size dim initialized by
init.
Call func given in the first argument on each key of hash-table. func must return the new key and the new value as two values. Those pairs are stored in a new hash-table.
Maps the elements of list in a hash-table identified by identifier. func is evaluated on each element and produces two values which are used as key and value for the hash-table.
Applies func to a product of lists. Example:
(map-product #'cons '(2 3) '(1 4)) ⇒ ((2 . 1) (2 . 4) (3 . 1) (3 . 4))
Maps tree using func. Example:
(map-tree #'1+ '((1 (2)))) ⇒ ((2 (3)))
Replaces the value of the variable var by setting it to its map with func.
Map func
over lists while appending the results.
Collects the arguments with which a mapping construct calls a given function. E.g.
(mapper-collect #'mapc '(3 4 5)) ⇒ (3 4 5)
Counts the arguments with which a mapping construct calls a given function. E.g.
(mapper-sum #'mapc '(3 4 5)) ⇒ 3
Tests if the test is fulfilled for every argument on which the mapper is called:
(mapper-every #'plusp #'mapc '(3 4 5)) ⇒ T
Select the arguments with which a mapping construct calls a given function. E.g.
(mapper-select-first #'mapc '(3 4 5) '(7 8 9)) ⇒ 3,7
Tests if the test is fulfilled for some argument on which the mapper is called:
(mapper-some #'plusp #'mapc '(-3 4 5)) ⇒ T
Sums the arguments with which a mapping construct calls a given function. E.g.
(mapper-sum #'mapc '(3 4 5)) ⇒ 12
Finds a maximally connected set by taking the union of the elements in connected with the sets of disconnected-sets. Returns the maximally connected sets and the remaining disconnected ones. Example:
(maximally-connected '(1 2) '((3 4) (2 3) (5 6)) :test #'intersection :combine #'union) ⇒ (1 2 3 4), ((5 6))
Measures the time in seconds needed by count-times executing fn.
Memoizes the function func which should be a non-recursive function of one argument.
Memoize expr for its arguments in the table table which should be nil or a hash-table with equal/equalp test.
Memoizes multi-argument functions named by the symbol funsym.
Wraps obj in a list, if it is not already a list.
Returns a list of all ordered partitions of k into n natural numbers. Example:
(n-partitions-of-k 2 3) ⇒ ((0 3) (1 2) (2 1) (3 0))
Returns a list of all nonempty subsets of set.
Executes func on the leaves of tree.
Calls func on every subtree of tree.
Returns a sequence of the same type as seq consisting of its partial sums.
Returns the inverse of the permutation given by perm-vec.
Checks if perm is a possible permutation vector. A permutation pi
is characterized by a vector containing the indices from 0,...,
length
(perm)-1 in some order.
Returns the sign of perm.
Functional version of permute-into
.
A permutation perm acts on the vector v by permuting it according to result[i] = v[perm[i]].
Positive fixnum tpye.
Returns a list of all positive ordered partitions of k into n natural numbers. Example:
(positive-n-partitions-of-k 2 3) ⇒ ((1 2) (2 1))
Returns a list of all positive ordered partitions of k. Example:
(positive-partitions-of-k 3) ⇒ ((1 2) (2 1))
A mixin adding a property slot to the class.
Direct slots:
Transforms queue to a list.
Constructor for a range of numbers.
Range of numbers for iteration.
Direct slots:
Supplies args to func from the right.
Reader for the element of vec referenced by iterator.
Calling this function results in an error. Such a call may be used as default form when an argument should be supplied.
Returns t if sequence consists of equal elements.
Removes the items marked by keys from the property list plist. This function was posted at 2.12.2002 to the comp.lang.lisp newsgroup by Erik Naggum.
Tests two sets for equality, e.g.
(set-equal '(a b) '(b a)) ⇒ T
Checks if list is a set, i.e. if no members occur twice.
Breaks the list items in pieces of lengths determined by nrins. Example:
(split-by-length '(1 2 3 4) '(1 3)) ⇒ ((1) (2 3 4))
Return the square of x.
Returns a list of all subsets of set.
Transfer items between the blackboards from-bb and to-bb. When ensure is set, an existing item is not modified.
Performs certain translations from an association table on the string item. Example: (translate "abcdefg" ’(("a" . "x") ("b" . "yz")))
Getter for a boxed object.
Reader for the last element of vec.
Map vec with func to a vector of the same type.
Work with the items on blackboard corresponding to properties. If some property is a list, the second element is the default value and the third is an alias to be used to refer to this parameter. Example:
(with-items (&key sol (rhs nil rhs-high)) blackboard (setq sol rhs-high))
Returns a uniform vector for the given element type filled with zeros.
Next: Package FL.MACROS, Previous: Reference manual, Up: Reference manual [Contents][Index]