NAME
Sidef::Types::Set::Bag
DESCRIPTION
This class implements ...
SYNOPSIS
var a = Bag(1, 1, 2, 3)
var b = Bag(1, 4, 3, 5)
say (a | b) #=> Bag(1, 1, 2, 3, 4, 5)
say (a ^ b) #=> Bag(1, 2, 4, 5)
say (a & b) #=> Bag(1, 3)
say (a - b) #=> Bag(1, 2)
say (a + b) #=> Bag(1, 1, 1, 2, 3, 3, 4, 5)
say a.count(1) #=> 2
say a.elems #=> 3
say a.len #=> 4
say a.keys #=> [1, 2, 3]
say a.freq #=> [[1, 2], [2, 1], [3, 1]]
INHERITS
Inherits methods from:
* Sidef::Types::Set::Set
METHODS
&
a & b
Returns the
Aliases: ∩, and, intersection
+
a + b
Returns the
Aliases: concat
-
a - b
Returns the
Aliases: ∖, sub, diff, difference
...
a ... b
Returns the
Aliases: to_list
<<
a << b
Returns the
Aliases: add, push, append
^
a ^ b
Returns the
Aliases: xor, symdiff, symmetric_difference
|
a | b
Returns the
Aliases: ∪, or, union
∋
a ∋ b
Returns the
Aliases: has, exists, has_key, haskey, contain, include, contains, includes
∌
a ∌ b
Returns the
≠
a ≠ b
Returns the
Aliases: !=, ne
≡
a ≡ b
Returns the
Aliases: ==, eq
≤
a ≤ b
Returns the
Aliases: ⊆, <=, is_subset
≥
a ≥ b
Returns the
Aliases: ⊇, >=, is_superset
add_kv
self.add_kv(obj, n)
Returns the
Aliases: push_kv, add_pair, append_kv, push_pair, append_pair
add_kvs
self.add_kvs(*pairs)
Returns the
Aliases: push_kvs, add_pairs, append_kvs, push_pairs, append_pairs
clone
self.clone
Returns the
collect
self.collect(block)
Returns the
contains_all
self.contains_all(*objects)
Returns the
count_by
self.count_by(block)
Returns the
delete
self.delete(*objects)
Returns the
Aliases: remove, discard
delete_all
self.delete_all(*objects)
Returns the
Aliases: remove_all, discard_all
delete_first_if
self.delete_first_if(block)
Returns the
delete_if
self.delete_if(block)
Returns the
delete_key
self.delete_key(obj)
Returns the
Aliases: remove_key, discard_key
dump
self.dump
Returns the
each
self.each(block)
Returns the
each_2d
self.each_2d(block)
Returns the
each_kv
self.each_kv(block)
Returns the
elems
self.elems
Returns the
Aliases: keys_len
freq
self.freq
Returns the
get
self.get(obj)
Returns the
Aliases: count
grep
self.grep(block)
Returns the
Aliases: select
grep_2d
self.grep_2d(block)
Returns the
grep_kv
self.grep_kv(block)
Returns the
iter
self.iter
Returns the
join
self.join(*rest)
Returns the
keys
self.keys
Returns the
kv
self.kv
Returns the
Aliases: pairs
len
self.len
Returns the
Aliases: size, length
map
self.map(block)
Returns the
map_2d
self.map_2d(block)
Returns the
map_kv
self.map_kv(block)
Returns the
max
self.max
Returns the
max_by
self.max_by(block)
Returns the
min
self.min
Returns the
min_by
self.min_by(block)
Returns the
new
self.new
Returns the
Aliases: call
pop
self.pop
Returns the
set_kv
self.set_kv(obj, n)
Returns the
Aliases: update_kv, update_pair, replace_pair
set_kvs
self.set_kvs(*pairs)
Returns the
Aliases: update_kvs, update_pairs, replace_pairs
shift
self.shift
Returns the
sort
self.sort(block)
Returns the
sort_by
self.sort_by(block)
Returns the
to_a
self.to_a
Returns the
Aliases: expand, to_array
to_bag
self.to_bag
Returns the
top
self.top(n)
Returns the
Aliases: most_common
to_set
self.to_set
Returns the
uniq
self.uniq
Returns the
Aliases: unique
values
self.values
Returns the