Given a number, print out its "collective sum"

05AB1E,  4  3 bytes

-1 thanks to Kevin Cruijssen (use of avoiding a })

€£O

Try it online!

How?

€£O - implicit input   e.g. 2315
€   - map with:
 £  -   head to             23, 231, 2, 2315
  O - sum                   2571

Python 2, 43 bytes

lambda n:sum(int('0'+n[:int(x)])for x in n)

Try it online!


Python 2, 72 bytes

First submission! Thanks to @DestructibleLemon for the help!

import sys;d=sys.argv[1];s=0;for e in d:s+=int(d[:int(e)]);print str(s)