
=encoding utf8

=head1 NAME

Sidef::Types::Set::Bag

=head1 DESCRIPTION

This class implements ...

=head1 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]]

=head1 INHERITS

Inherits methods from:

       * Sidef::Types::Set::Set

=head1 METHODS

=head2 &

    a & b

Returns the

Aliases: I<∩>, I<and>, I<intersection>

=cut

=head2 +

    a + b

Returns the

Aliases: I<concat>

=cut

=head2 -

    a - b

Returns the

Aliases: I<∖>, I<sub>, I<diff>, I<difference>

=cut

=head2 ...

    a ... b

Returns the

Aliases: I<to_list>

=cut

=head2 <<

    a << b

Returns the

Aliases: I<add>, I<push>, I<append>

=cut

=head2 ^

    a ^ b

Returns the

Aliases: I<xor>, I<symdiff>, I<symmetric_difference>

=cut

=head2 |

    a | b

Returns the

Aliases: I<∪>, I<or>, I<union>

=cut

=head2 ∋

    a ∋ b

Returns the

Aliases: I<has>, I<exists>, I<has_key>, I<haskey>, I<contain>, I<include>, I<contains>, I<includes>

=cut

=head2 ∌

    a ∌ b

Returns the

=cut

=head2 ≠

    a ≠ b

Returns the

Aliases: I<!=>, I<ne>

=cut

=head2 ≡

    a ≡ b

Returns the

Aliases: I<==>, I<eq>

=cut

=head2 ≤

    a ≤ b

Returns the

Aliases: I<⊆>, I<E<lt>=>, I<is_subset>

=cut

=head2 ≥

    a ≥ b

Returns the

Aliases: I<⊇>, I<E<gt>=>, I<is_superset>

=cut

=head2 add_kv

    self.add_kv(obj, n)

Returns the

Aliases: I<push_kv>, I<add_pair>, I<append_kv>, I<push_pair>, I<append_pair>

=cut

=head2 add_kvs

    self.add_kvs(*pairs)

Returns the

Aliases: I<push_kvs>, I<add_pairs>, I<append_kvs>, I<push_pairs>, I<append_pairs>

=cut

=head2 clone

    self.clone

Returns the

=cut

=head2 collect

    self.collect(block)

Returns the

=cut

=head2 contains_all

    self.contains_all(*objects)

Returns the

=cut

=head2 count_by

    self.count_by(block)

Returns the

=cut

=head2 delete

    self.delete(*objects)

Returns the

Aliases: I<remove>, I<discard>

=cut

=head2 delete_all

    self.delete_all(*objects)

Returns the

Aliases: I<remove_all>, I<discard_all>

=cut

=head2 delete_first_if

    self.delete_first_if(block)

Returns the

=cut

=head2 delete_if

    self.delete_if(block)

Returns the

=cut

=head2 delete_key

    self.delete_key(obj)

Returns the

Aliases: I<remove_key>, I<discard_key>

=cut

=head2 dump

    self.dump

Returns the

=cut

=head2 each

    self.each(block)

Returns the

=cut

=head2 each_2d

    self.each_2d(block)

Returns the

=cut

=head2 each_kv

    self.each_kv(block)

Returns the

=cut

=head2 elems

    self.elems

Returns the

Aliases: I<keys_len>

=cut

=head2 freq

    self.freq

Returns the

=cut

=head2 get

    self.get(obj)

Returns the

Aliases: I<count>

=cut

=head2 grep

    self.grep(block)

Returns the

Aliases: I<select>

=cut

=head2 grep_2d

    self.grep_2d(block)

Returns the

=cut

=head2 grep_kv

    self.grep_kv(block)

Returns the

=cut

=head2 iter

    self.iter

Returns the

=cut

=head2 join

    self.join(*rest)

Returns the

=cut

=head2 keys

    self.keys

Returns the

=cut

=head2 kv

    self.kv

Returns the

Aliases: I<pairs>

=cut

=head2 len

    self.len

Returns the

Aliases: I<size>, I<length>

=cut

=head2 map

    self.map(block)

Returns the

=cut

=head2 map_2d

    self.map_2d(block)

Returns the

=cut

=head2 map_kv

    self.map_kv(block)

Returns the

=cut

=head2 max

    self.max

Returns the

=cut

=head2 max_by

    self.max_by(block)

Returns the

=cut

=head2 min

    self.min

Returns the

=cut

=head2 min_by

    self.min_by(block)

Returns the

=cut

=head2 new

    self.new

Returns the

Aliases: I<call>

=cut

=head2 pop

    self.pop

Returns the

=cut

=head2 set_kv

    self.set_kv(obj, n)

Returns the

Aliases: I<update_kv>, I<update_pair>, I<replace_pair>

=cut

=head2 set_kvs

    self.set_kvs(*pairs)

Returns the

Aliases: I<update_kvs>, I<update_pairs>, I<replace_pairs>

=cut

=head2 shift

    self.shift

Returns the

=cut

=head2 sort

    self.sort(block)

Returns the

=cut

=head2 sort_by

    self.sort_by(block)

Returns the

=cut

=head2 to_a

    self.to_a

Returns the

Aliases: I<expand>, I<to_array>

=cut

=head2 to_bag

    self.to_bag

Returns the

=cut

=head2 top

    self.top(n)

Returns the

Aliases: I<most_common>

=cut

=head2 to_set

    self.to_set

Returns the

=cut

=head2 uniq

    self.uniq

Returns the

Aliases: I<unique>

=cut

=head2 values

    self.values

Returns the

=cut
