tl;dr Can anyone recommend a data structure that is ordered and supports efficient reordering, insertion at arbitrary location, and deletion?
Long form: I'm working on an operation-log reconciliation problem, where each operation is one of: File-Create P H File-Update P H File-Delete P H Folder-Create P Folder-Delete P P = path H = hash of the file (e.g. md5) Operation messages travel over the network, meaning that they could arrive out of order. (They could also be missed entirely, but that's a separate problem that I'm not working on yet.) Specifically, I want to be able to take a series of messages and collapse them where appropriate. For example: File-Update P H1 -> H2 File-Create P1 H1 Result after collapse: '(File-Create P1 H2) File-Create P H1 File-Delete P H1 Result after collapse: '() File-Delete P X File-Create P X Result after collapse: '() File-Delete P1 H1 File-Create P2 H2 File-Create P1 H1 Result after collapse: '(File-Create P2 H2) I've been mulling over various ways to handle all of this and digging around to find examples of other people doing it, but I'm wondering if there's a data structure or existing algorithm that will handle it cleanly. Does anyone know of such a thing? -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAE8gKoe-GHZvVFu7vr%2B6%2BJ27TmF0LgzaxFpC1yzDRzaO6tqhTw%40mail.gmail.com.