previous up contents next
Left: APU Up: Arithmetic functions Right: Add

Sum

Sum returns as value the sum of the integers that form (the integer prefix of) the path.

    Sum:<> = 0.
    Sum:<foo> = 0 foo.
    Sum:<0> = 0.
    Sum:<1> = 1.
    Sum:<1 2 3 4> = 10.
    Sum:<1 -2 3 -4> = -2.
    Sum:<1 2 3 4 foo> = 10 foo.

Think of the empty path as a weightless box. Its weight is 0. Put the weightless object (i.e. 0) in it and the weight of both box and contents is 0.


---------------------------------------------------------

Copyright © Roger Evans, Gerald Gazdar & Bill Keller, Tuesday 10 November 1998