<commit_before>module.exports = function sum(list, fn) {
	if (!list) { return 0 }
	var total = 0
	for (var i=0; i<list.length; i++) {
		total += fn(list[i])
	}
	return total
}<commit_msg>make identity the default sum function, to easily sum up an array of numbers<commit_after>var identity = require('std/identity')

module.exports = function sum(list, fn) {
	if (!list) { return 0 }
	if (!fn) { fn = identity }
	var total = 0
	each(list, function(val, key) {
		total += fn(val, key)
	})
	return total
}
{'fraction_non_alphanumeric': 0.14910536779324055, 'fraction_numerical': 0.009940357852882704, 'mean_word_length': 4.04, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4896032', 'n_tokens_mistral': 184, 'n_tokens_neox': 176, 'n_words': 59}