group a list into an expression sequence of lists - Maple Help

Online Help

All Products    Maple    MapleSim


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

ListTools[Group] - group a list into an expression sequence of lists

Calling Sequence

Group(f, L, opts, ...)

Group[N](f, opt[1], ..., opt[N-1], L, opts, ...)

Parameters

L

-

list

f

-

procedure

N

-

positive integer

opts

-

(optional) options to procedure f

Description

• 

The Group(f, L) function groups list L into sublists where procedure f returns either true or false. The value of procedure f is determined by the expression fx evaluated for each element x of list L.

  

The Group(f, L, opts) function performs in a similar manner, except that the value of procedure f is determined by the expression fx,opts.

• 

If Group is indexed by a positive integer N, the expression fopt1,...,optN1,x,opts is evaluated for each list element x.

Examples

withListTools:

L:=`$`1..10

L:=1,2,3,4,5,6,7,8,9,10

(1)

Groupisprime,L

1,2,3,4,5,6,7,8,9,10

(2)

Grouptype,L,'even'

1,2,3,4,5,6,7,8,9,10

(3)

Digits:=5

Digits:=5

(4)

Group`>`,seqsin2.0x,x=1..12,12

0.90930,0.75680,0.27942,0.98936,0.54402,0.53657,0.99061,0.28790,0.75099,0.91295,0.0088513,0.90558

(5)

Groupevalb@`>`,seqsin2.0x,x=1..12,12

0.90930,0.75680,0.27942,0.98936,0.54402,0.53657,0.99061,0.28790,0.75099,0.91295,0.0088513,0.90558

(6)

Group2verify,12,seqsin2x,x=1..12,less_than

sin2,sin4,sin6,sin8,sin10,sin12,sin14,sin16,sin18,sin20,sin22,sin24

(7)

See Also

list, ListTools, map, type[list]


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