ListTools - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Data Types : Tables, lists, and sets : ListTools Package : ListTools/FindRepetitions

ListTools

  

FindRepetitions

  

find the repeated elements in a list

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

FindRepetitions(L, N, f, opt1, opt2, ...)

Parameters

L

-

list

N

-

(optional) non-negative integer or infinity

f

-

(optional) procedure

opt1, opt2, ...

-

(optional) extra arguments to f

Description

• 

The FindRepetitions(L) function inspects the elements in list L and returns all the elements which previously appeared in the list.

• 

If the optional second argument is specified, FindRepetitions(L, N) removes N copies of each unique element in list L (if possible).

• 

By default, operands are compared by using boolean comparison. If a third argument is specified, then the function f(x, y, opt1, opt2, ...) is called to check if x and y should be considered equal. This function should implement an equivalence relation (i.e. it should be reflexive, commutative, and transitive).  If it is not, then the result may not be valid.

Examples

withListTools:

L1,2,3,4,3,2,3,4,5,4,3,4,5,6

L:=1,2,3,4,3,2,3,4,5,4,3,4,5,6

(1)

FindRepetitionsL

3,2,3,4,4,3,4,5

(2)

FindRepetitionsL,0

1,2,3,4,3,2,3,4,5,4,3,4,5,6

(3)

FindRepetitionsL,2

3,4,3,4

(4)

FindRepetitionsL,'∞'

(5)

L0,x1x+1,0.,x21,0.,1xx+1

L:=0,x1x+1,0.,x21,0.,1xx+1

(6)

FindRepetitionsL

(7)

FindRepetitionsL,1,verify,expand

0.,x21,0.,1xx+1

(8)

See Also

list

ListTools

ListTools[MakeUnique]

type/list

verify

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam