User loginNavigation | 
   
Reversing operationsIf one wants to iterate through all reachable states s1 from an initial state s0 in an imperative language (think of a chess board and a possible set of moves) one could do something like: 
for i in 1..#changes {
    s1 := copy(s0)
    change(s1, i)
    // process s1
}
It is usually faster and less memory intensive to do the following instead: 
for i in 1..#changes {
    change(s0, i) pushing undo data to the stack
    // process s0
    undo(s0) popping undo data from the stack
}
Are there general techniques for inferring the "undo data" that an operation should save, and possibly the corresponding undo operation? By Pablo Barenbaum at 2012-03-12 17:03 | LtU Forum | previous forum topic | next forum topic | other blogs | 8440 reads 
 | 
   Browse archives
 Active forum topics | 
  
Recent comments
10 hours 5 min ago
1 day 14 hours ago
1 day 15 hours ago
6 days 15 hours ago
6 days 16 hours ago
6 days 16 hours ago
4 weeks 8 hours ago
4 weeks 5 days ago
4 weeks 5 days ago
5 weeks 8 hours ago