Learning in social and economic networks