score = (x) -> if x == "Yes" 10 else 0 weights = [0.25, 0.25, 0.25, 0.25] indigenous_peoples_rights = [commitment, impact_identification, requirements, practices] weights.reduce((weighted_sum, weight, index) -> weighted_sum + weight*score(indigenous_peoples_rights[index]) , 0)