How do you know when to use fold-left and when to use fold-right?
问题 I'm aware that fold-left produces left-leaning trees and fold-right produces right-leaning trees, but when I reach for a fold, I sometimes find myself getting bogged down in headache-inducing thought trying to determine which kind of fold is appropriate. I usually end up unwinding the entire problem and stepping through the implementation of the fold function as it applies to my problem. So what I want to know is: What are some rules of thumb for determining whether to fold left or fold right