So far you’ve seen how to process each element in a list, but what if we want to sum all of the elements? The difference here is that we need to remember the partial sum as we process each element in turn.
why is that?
sum([head|tail]), do head+sum(tail) would work. Is it because of tail call optimization?
Share this highlighthttp://www.safaribooksonline.com/a/programming-elixir-13/6102297/