very basic version of accumulate in go