tcl sum part of list
% Tcl - tool command language
% Make Arbitrary List Variable
set List {1 2.01 33 4.2536}
% Sum Elements using expr & join:
set sum [expr [join $List +]];
puts $sum;
% Sum Partial List using lrange
set List_Partial [lrange $List 0 2];
set sum_Partial [expr [join $List_Partial +]];
puts $sum_Partial;
% Of course we can combine this into a single line and apply additional arithmetic in expr:
set sum_41 [expr [join [lrange $List 0 2] +] - 99];
puts $sum_41;