Sum of array members using pml

2571515_Programmirovanie.jpgIf we need to calculate sum of array members,
we don have such method in standard functionality. Also we don’t have ability to create array with n-th members only have to push them manually with loop.

We can use such pml code to workaround.

Lets imagine that we have string !string equals to 1,2,3,4,5,6,7,7,6,5,4,3,2,1

!string = ‘1,2,3,4,5,6,7,7,6,5,4,3,2,1’
!array = !string.split(‘,’)

var !arrayGrp eval ” indices !array
var !indGrp sort !arrayGrp lastingroup !group
var !totGrp subt !array !indGrp !group

q var !totGrp.last()
’56’

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s