hashmset - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


hashmset

Multiset data structure

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

hashmset[new]( v1 = m1, v2 = m2, ..., vk = mk )

hashmset[new]( [ v1, m1 ], [ v2, m2 ], ..., [ vk, mk ] )

hashmset[empty]( s )

hashmset[entries]( s )

hashmset[members]( s )

hashmset[insert]( v, m, s )

hashmset[insert]( v = m, s )

hashmset[remove]( v = m, s )

hashmset[remove]( v, m, s )

hashmset[`subset`]( s, t )

hashmset[`intersect`]( s, t )

hashmset[`union`]( s, t )

hashmset[`minus`]( s, t )

hashmset[symdif]( s, t )

Parameters

v, v1, v2, ..., vk

-

anything; values to be inserted into, or removed from, the multiset

m, m1, m2, ..., mk

-

posint; multiplicities of corresponding values

s, t

-

name; multiset

Description

• 

Important: The hashmset package has been deprecated. Use the superseding package MultiSet instead.

• 

The hashmset package provides an implementation of multisets. A multiset is an unordered collection of objects, in which objects can appear more than once. The number of occurrences of an object in a multiset is called its ``multiplicity''.

• 

The new command returns a new multiset with the specified values and multiplicities. If called with no arguments, the returned multiset is empty.

• 

The empty command tests whether s is an empty multiset. If the multiset s is empty, the empty function returns true. Otherwise, it returns false.

• 

The entries command returns a list of pairs of the form v,m, in which v is an expression in the multiset s, and m is its multiplicity.

• 

The members command returns the set of expressions that appear in the multiset s. It does not return information about their respective multiplicities.

• 

The insert command adds a new element v to the multiset s or, if v is an element in s, increases the multiplicity of v in s. The multiplicity of v in s increases by the positive integer m.

• 

The remove command deletes an element v from the multiset s, or, if m is less than the multiplicity of v in s, reduces the multiplicity of v in s. The multiplicity of v is reduced by the positive integer m.

• 

The subset operator tests whether the multiset s (its first argument) is a proper sub-multiset of the multiset t (its second argument).

• 

The intersect operator computes the intersection of the multisets s and t.

• 

The union operator computes the union -- as multisets -- of s and t.

• 

The symdif command computes the symmetric difference of s and t.

• 

The minus operator computes the multiset difference of s and t.

• 

Because many hashmset export names (functions and operators) match global function and operator names, it is recommended that you use the long form of the hashmset package names, for example, hashmset[export_name] or hashmset:-export_name.

Examples

Important: The hashmset package has been deprecated. Use the superseding package MultiSet instead.

shashmset:-newa,2,b,3:

hashmset:-entriess

b,3,a,2

(1)

hashmset:-memberss

a,b

(2)

hashmset:-emptys

false

(3)

hashmset:-inserta=2,s

4

(4)

hashmset:-entriess

b,3,a,4

(5)

hashmset:-insertc=2,s

2

(6)

hashmset:-entriess

b,3,a,4,c,2

(7)

hashmset:-removea=3,s

hashmset:-entriess

b,3,a,1,c,2

(8)

thashmset:-newa=2,b=4,c=3,d=1:

usehashmsetins⊆t;entriess∩t;entriess∪t;entriest∖send use

b,1,a,1,d,1,c,1

(9)

entrieshashmset:-symdifs,t

1,1,1,1

(10)

See Also

convert/multiset

DEQueue

Long Form Names

priqueue

use