lists-and-sets

Class summary
sorted-list-merger
Method summary
key sorted-list-merger
lists sorted-list-merger
next-item (sorted-list-merger sorted-list-merger)
test sorted-list-merger
tree-difference a b
Function summary
add-hash-table table1 table2 &key overwrite
all-biggest fn l &key (key (function identity))
all-smallest fn l
all-subsets list &key (min-length 1)
always &rest elements
array->list array
assq obj list &key (test (function eq))
assqv obj list &key (test (function eq))
binary-search sorted-vector value &key (key (function identity)) (test (function <=))
collect-ignore-nils &rest lists
combinations &rest lists
combinations-of-length elements length
copy-hash-table source
deep-reverse tree
duplicates? list &key (test (function equal)) (key (function identity))
eq-sets set-1 set-2
eql-sets set-1 set-2
equal-sets set-1 set-2 &key (test (function equal)) key
extremum list &key (key (function identity)) (test (function >))
extremum-position list &key (key (function identity)) (test (function >))
find-all what lst &key (test (function eq)) (key (function identity))
find-all-anywhere item tree &key (test (function eq)) (key (function identity))
find-all-anywhere-if test tree &key (key (function identity))
find-all-anywhere-of-type type tree &key (key (function identity))
find-all-if test lst &key (key (function identity))
find-all-if-not test lst &key (key (function identity))
find-all-of-type type lst &key (key (function identity))
find-anywhere item tree &key (test (function eq)) (key (function identity))
find-of-type type lst &key (key (function identity))
flatten list
get-duplicate-elements lst
is-set list &key (test (function eq)) key
is-subset sub-set super-set &key (test (function eq)) key
length< arg1 arg2
length<= arg1 arg2
length= arg1 arg2
length> arg1 arg2
length>= arg1 arg2
list->array list
list-length<=l list1 list2
list-length<=n list length
list-length<l list1 list2
list-length<n list length
list-length=l list1 list2
list-length=n list length
list-length>=l list1 list2
list-length>=n list length
list-length>l list1 list2
list-length>n list length
listify element
listxlist l1 l2 &key (combiner (function list))
mappend fn &rest lists
mapunion fn &rest lists
member-of-tree item tree
nmerge lists &key (key (function identity)) (test (function >))
permutate-list list
permutation-of? l1 l2 &key (key (function identity)) (test (function eql))
permutations-of-length elements length &optional (copy-fn (function identity))
random-elt l
random-elt-if predicate list
random-elts seq n
random-other elts seq
random-shuffle sequence
random-subset list &key (include-empty-set? t)
remove-first item sequence &key (test (quote equal)) test-not
remove-nth nth sequence &key
replace-by-variable item tree
set-partitions list &key (min-length 1) max-length
shuffle l
simple-shuffle list
simple-sort lst &key (test (function <)) (key (function identity))
sorted-insert list to-insert &key (key (function identity)) (test (function <))
sorted-p list predicate &key (key (function identity))
the-biggest fn l &optional cut-of
the-highest lst func
the-smallest fn l
the-x-highest lst nr-of-highest &key (key (function identity))
true &rest args
union+ &rest sets
write-list elements &optional (stream t)
write-list2 elements &optional (stream t)
%fast-sorted-insert-default-key list to-insert test
%fast-sorted-insert-default-key-and-test list to-insert
%fast-sorted-insert-default-test list to-insert key
Macro summary
pushend item location
toggle var &rest vars
sorted-list-merger    [Class]
:lists    [Initarg]
:key    [Initarg]
:test    [Initarg]
sorted-lists    [Slot]

A list of lists, each of which is sorted according to some attribute

key    [Slot]

The key after which the lists are sorted

test    [Slot]

The test after which the keys are sorted

test   sorted-list-merger  [Generic function]

Returns and (with setf) changes the test of the specified sorted-list-merger

key   sorted-list-merger  [Generic function]

Returns and (with setf) changes the key of the specified sorted-list-merger

lists   sorted-list-merger  [Generic function]

Returns and (with setf) changes the sorted-lists of the specified sorted-list-merger

*english-list*    [Variable]
*english-list2*    [Variable]
tree-difference   a b  [Generic function]

returns a list of things that are in b but not in a

next-item   (sorted-list-merger sorted-list-merger)  [Method]
listify   element  [Function]

Creates (list element) only when element is not (1) a list or (2) nil.

write-list   elements &optional (stream t)  [Function]
write-list2   elements &optional (stream t)  [Function]
assq   obj list &key (test (function eq))  [Function]

Calls assoc with eq as test predicate.

assqv   obj list &key (test (function eq))  [Function]

Calls assoc with eq as test predicate, and returns cdr of found value or nil.

list-length=n   list length  [Function]
list-length=l   list1 list2  [Function]
list-length>n   list length  [Function]
list-length>l   list1 list2  [Function]
list-length<n   list length  [Function]
list-length<l   list1 list2  [Function]
list-length>=n   list length  [Function]
list-length>=l   list1 list2  [Function]
list-length<=n   list length  [Function]
list-length<=l   list1 list2  [Function]
length=   arg1 arg2  [Function]
length>   arg1 arg2  [Function]
length<   arg1 arg2  [Function]
length>=   arg1 arg2  [Function]
length<=   arg1 arg2  [Function]
remove-first   item sequence &key (test (quote equal)) test-not  [Function]
remove-nth   nth sequence &key  [Function]
mappend   fn &rest lists  [Function]

Append the results of calling fn on each element of list

mapunion   fn &rest lists  [Function]
flatten   list  [Function]
listxlist   l1 l2 &key (combiner (function list))  [Function]
combinations   &rest lists  [Function]
combinations-of-length   elements length  [Function]
set-partitions   list &key (min-length 1) max-length  [Function]

computes a list of all partitions of a set: (set-partitions '(a b c)) -> (((a b c)) ((a b) (c)) ((a c) (b)) ((a) (b c)) ((a) (b) (c))) algorithm from Michael Orlov (2002). Efficient Generation of Set Partitions.

all-subsets   list &key (min-length 1)  [Function]

a slow hack for getting all subsets of a list. needs to be properly written

random-subset   list &key (include-empty-set? t)  [Function]

Returns a random subset both in the amount of elements and in which elements it picks.

true   &rest args  [Function]
sorted-insert   list to-insert &key (key (function identity)) (test (function <))  [Function]

Assumes a list sorted on func. Will insert the given el in the list based on test. Example: (sorted-insert '(1 2 4 5) 3) --> (1 2 3 4 5)

%fast-sorted-insert-default-test   list to-insert key  [Function]
%fast-sorted-insert-default-key   list to-insert test  [Function]
%fast-sorted-insert-default-key-and-test   list to-insert  [Function]
binary-search   sorted-vector value &key (key (function identity)) (test (function <=))  [Function]

Performs a binary search on the given vector and returns the first element for which the sought value satisfies the test

collect-ignore-nils   &rest lists  [Function]

Like (list) except that it does not put nil elements into the list

list->array   list  [Function]

Returns the given list as an array

array->list   array  [Function]

Returns the given array as a list

simple-shuffle   list  [Function]

A very naive non destructive shuffle implementation.

shuffle   l  [Function]
permutate-list   list  [Function]

Permutates a list containing the permuted elements of the given list.

permutation-of?   l1 l2 &key (key (function identity)) (test (function eql))  [Function]
duplicates?   list &key (test (function equal)) (key (function identity))  [Function]

Checks whether an element occurs twice in the same list. Only use on short lists.

random-elt   l  [Function]
random-elts   seq n  [Function]
random-other   elts seq  [Function]
random-elt-if   predicate list  [Function]

Returns a random element that satisfies the predicate

random-shuffle   sequence  [Function]

Randomly orderes the elements in sequence

permutations-of-length   elements length &optional (copy-fn (function identity))  [Function]
the-highest   lst func  [Function]

Loops over the given list and evaluates function on every item. It returns the item for which the function returned the highest value. If there are multiple it gives the first one.

the-x-highest   lst nr-of-highest &key (key (function identity))  [Function]

Loops over the given list and evaluates function on every item. It returns the item for which the function returned the highest value. If there are multiple it gives the first one. You must supply a third parameter which allows you to get the x highest elements. It will even return these x elements ordered so from high to low.

simple-sort   lst &key (test (function <)) (key (function identity))  [Function]
the-biggest   fn l &optional cut-of  [Function]
all-biggest   fn l &key (key (function identity))  [Function]
the-smallest   fn l  [Function]
all-smallest   fn l  [Function]
get-duplicate-elements   lst  [Function]
find-of-type   type lst &key (key (function identity))  [Function]
find-all   what lst &key (test (function eq)) (key (function identity))  [Function]
find-all-of-type   type lst &key (key (function identity))  [Function]
find-all-if   test lst &key (key (function identity))  [Function]
find-all-if-not   test lst &key (key (function identity))  [Function]
find-anywhere   item tree &key (test (function eq)) (key (function identity))  [Function]
find-all-anywhere   item tree &key (test (function eq)) (key (function identity))  [Function]
find-all-anywhere-of-type   type tree &key (key (function identity))  [Function]
find-all-anywhere-if   test tree &key (key (function identity))  [Function]
member-of-tree   item tree  [Function]

looks whether feature-value or symbol is member of tree (any depth)

replace-by-variable   item tree  [Function]

replaces feature-value or symbol in tree with new variable (any depth)

deep-reverse   tree  [Function]

Reverses a tree recursively (deep)

union+   &rest sets  [Function]

Returns the union of any number of sets.

is-set   list &key (test (function eq)) key  [Function]

Return true if the given list does not contain the same element twice.

is-subset   sub-set super-set &key (test (function eq)) key  [Function]

Return true if each member of the given sub-set is a member of the given super-set. This function assumes that the given list are sets!

equal-sets   set-1 set-2 &key (test (function equal)) key  [Function]

Return true if the given sets contain the same elements.

eq-sets   set-1 set-2  [Function]

Return true if the given sets contain the same elements.

eql-sets   set-1 set-2  [Function]

Return true if the given sets contain the same elements.

always   &rest elements  [Function]

Returns true if all elements evaluate to true.

copy-hash-table   source  [Function]
add-hash-table   table1 table2 &key overwrite  [Function]

copies table2 into table1

sorted-p   list predicate &key (key (function identity))  [Function]
extremum   list &key (key (function identity)) (test (function >))  [Function]

Returns the element of the list which maximises/minimises the given key. This is the element which would come first if you sorted the list with the same key + test.

extremum-position   list &key (key (function identity)) (test (function >))  [Function]

Returns the position of the element in the list which maximises/minimises the given key. This is the position of the element which would come first if you sorted the list with the same key + test.

nmerge   lists &key (key (function identity)) (test (function >))  [Function]

Non-destructively merges the ordered lists contained in the passed list together into one ordered list. The list content itself is not copied, but the resulting list is made up of new conses so as not to destroy the original lists

pushend   item location  [Macro]

Append the item to the list in the given location, and returns the list.

toggle   var &rest vars  [Macro]