manual:chapter6:lists:cmd_sumlist

Synopsis


Return the sum of all elements in a list

Stack Diagram


Input Stack Output Stack
Ldata Osum
Level 1 Level 1

Legend

Keyword type Command
Parallel list processing capabilities Group 2 Commands that must use DOLIST to parallel process
Affected by flags None

Description


The ΣLIST command returns the sum of all the elements in Ldata, i.e.: $$ \sum_{k=1}^{n}{data_{k}} $$ The list must not be empty and its elements must be suitable for mutual addition.

Compatibility


ΣLIST is not fully equivalent to its userRPL counterpart.

In particular:

  • in userRPL the list must contain at least two elements.

Usage


Input

4:                                      
3:                                      
2:                                      
1:                       { 1 'X' '3*Y' }
…………………………………………………………………………………………………………
ΣLIST                                   


Output

4:                                      
3:                                      
2:                                      
1:                             '1+X+3*Y'
…………………………………………………………………………………………………………
                                        

Related Commands


Operations with Lists 15 2 NEW

Command Short Description
→LIST Assemble a list from its elements
LIST→ Split a list into its elements
DOLIST Do a procedure with elements of lists CHANGED
DOSUBS Do a procedure on a subset of a list CHANGED
MAP Do a procedure on each element of a list, recursively
MAPLIST→ Do a procedure on each element recursively, return individual elements NEW
STREAM Do a procedure on consecutive elements of a list
ΔLIST First differences on the elements of a list
ΣLIST Sum of all elements in a list CHANGED
ΠLIST Product of all elements in a list CHANGED
ADD Concatenate lists and/or elements CHANGED
SORT Sort elements in a list
REVLIST Reverse the order of elements in a list
ADDROT Add elements to a list, keep only the last N elements NEW
SEQ Assemble a list from results of sequential procedure
  • manual/chapter6/lists/cmd_sumlist.txt
  • Last modified: 2021/10/02 08:05
  • by jojo1973