| |
- cyclic_pairs(lst)
- cyclic_pairs(lst)
Returns the cyclic pairs of LST as a list of 2-tuples.
- every(f, lst)
- every(f, lst) -> true if F applied to every element of LST is true
- find(p, lst, start=0)
- find(p, lst, start)
Returns the first index i (>= START) where P(LST[i]) is true or
-1 if there is none.
- first_difference(lst)
- first_difference(lst) -> the first differences of the values in LST
- flatten(seq)
- Returns a list of the contents of seq with sublists and tuples "exploded".
The resulting list does not contain any sequences, and all inner sequences
are exploded. For example:
>>> flatten([7,(6,[5,4],3),2,1])
[7,6,5,4,3,2,1]
- flatten1(seq)
- Return a list with the contents of SEQ with sub-lists and tuples "exploded".
This is only done one-level deep.
- intersection(a, b)
- intersection(a, b) -> list of items in both A and B
The order of the result items is unspecified.
If all items are hashable, then this algorithm is
O(size(a) + size(b)); otherwise, it is O(size(a) * size(b))
- lebesgue_norm(p, lst)
- l_norm(p, lst) -> Lebesgue norm with parameter P for number list LST
- list2dict(lst)
- list2dict(lst) -> dict mapping from LST's indices to its elements
In Python 2.2, use the dict() constructor.
- mapdict(f, d)
- mapdict(f, d)
Return a new dict just like D, but with each value V replaced with F(V).
- maximum(cmp, lst)
- maximum(cmp, lst)
Returns the maximal element in non-empty list LST with elements
compared via CMP() which should return values with the same semantics
as Python's cmp(). If there are several maximal elements, the last
one is returned.
- mean(lst)
- mean(lst) -> the arithmetic mean of the values in LST
- minimum(cmp, lst)
- minimum(cmp, lst)
Returns the minimal element in non-empty list LST with elements
compared via CMP() which should return values with the same semantics
as Python's cmp(). If there are several minimal elements, the last
one is returned.
- number_of_leading(p, lst)
- number_of_leading(p, lst)
Returns the number of leading elements X of LST for which P(X) is true.
- number_of_trailing(p, lst)
- number_of_trailing(p, lst)
Returns the number of trailing elements X of LST for which P(X) is true.
- partition_list(f, lst)
- Given function F and list F, return tuple (matched, nonmatched),
where matched is a list of all elements E for which F(E) is true, and
nonmatched the remainder.
- remove_duplicates(lst, key=None)
- Returns a list equivalent to SEQ with repeated elements removed.
(The first occurence of each value is retained. Note that this is the
opposite of the Common Lisp default behavior.)
If KEY is provided, then repeats are detected by comparing KEY(ELEMENT)
for each element.
- reverse(lst)
- reverse(lst) -> reversed copy of LST
- some(f, lst)
- some(f, lst) -> true if F applied to some element of LST is true
- sort(p, lst)
- sort(p, lst) -> sorted copy of LST
- stddev(lst)
- stddev(lst) -> standard deviation of values in LST
- sum(lst)
- sum(lst) -> sum of numbers in LST
- transpose(seq_of_seqs)
- Returns the matrix transpose of SEQ_OF_SEQS as a list of tuples.
SEQ_OF_SEQS must be rectangular for this to make sense.
- variance(lst)
- variance(lst) -> variance of values in LST
|