Eating a diet that is high in fat or sugar can do more than just contribute to unhealthy weight; a new study has shown that such diets could also decrease cognitive function.