sc3.base.utils module¶
Functions used to process lists as in sclang. At the moment they are mostly for internal use.
-
as_list
(obj)¶ Bubble non iterable objects, tuples and strings in a list. If obj is None returns an empty list. For the rest of iterators is the same as list(obj).
-
unbubble
(obj)¶ If obj is a list of one item or any other object unbubble(obj) returns the item, otherwise returns the list or object unchanged.
-
flat
(inlist)¶
-
flatten
(inlist, n_levels=1)¶
-
shape
(lst)¶
-
reshape_like
(one, another)¶
-
deep_collect
(inlist, depth, func, index=0, rank=0)¶
-
extend
(lst, n, item)¶ Create a new list by extending lst with item.
-
wrap_extend
(lst, n)¶ Create a new list by extending lst with its own elements cyclically.
-
list_unop
(op, a, t=None)¶
-
list_binop
(op, a, b, t=None)¶ Operate on sequences element by element and return a sequence of type t (default to list) if any argument a or b is sequence. Arguments a and b may be types or a sequence of types compatible with operator op. Nested sequences are processed recursively. Recursion uses tuple type cast if any is tuple or type(a) if is a is sequence else type(b) if b is sequence. Tuples are termporary converted to lists to process. All this is needed because multichannel expansion behaviour (e.g. in Env).
-
list_narop
(op, a, *args, t=None)¶
-
list_sum
(lst, t=None)¶
-
list_min
(lst, t=None)¶
-
list_max
(lst, t=None)¶
-
clump
(lst, n)¶
-
gen_cclumps
(l, n=1)¶ return n items as pairsDo does (with n=2) for iteration, cclump stands for complete clump, it discards possible non full clump at the end
-
pairwise
(iterable)¶ s -> (s0,s1), (s1,s2), (s2, s3), …
-
lace
(lst, size=None)¶
-
flop
(lst)¶
-
flop_together
(*lsts)¶
-
max_depth
(lst)¶
-
max_size_at_depth
(lst, rank)¶
-
wrap_at_depth
(lst, rank, index)¶
-
flop_deep
(lst, rank)¶
-
multichannel_expand_tuple
(tpl, rank)¶