Scheme accumulative recursion with lists
问题 How can I pass a list as a parameter to a function adding elements to it recursively,and have it unmodified when it comes out of recursion? I want to use the list at each level of recursion with the list having the values added by deeper recursion levels. To be more specific I want to do a DFS search on a graph and I want to store in the list the nodes I visited. 回答1: One method of doing this is just to return the list so you have access to it at higher levels of recursion. Another method is