-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft: {find,canonicalize} vs unsafe{Find,Canonicalize} #12
base: master
Are you sure you want to change the base?
Conversation
692d233
to
1208a91
Compare
This looks good to me now. It's an improvement and probably even more so for just-e-graph users. There's one thing against the lazy-e-graph-forced-on-rebuild point of view that I'm wondering if we can fix, but which is not really a problem. In the lazy point of view, calling That would make me expect that egr = ... -- (1) un-rebuilt e-graph
find 2 egr -- (2) forces e-graph to be rebuilt
find 3 egr -- (3) e-graph has been forced, so this should be now instantaneous My case is with (3). Calling find a second time will still rebuild the e-graph completely, which makes the lazy argument a bit weaker. Just wondering if we can make this fit in the lazy idea, or if it's better not to consider it 100% as a lazy e-graph (and not advertise it as such) It would be very cool if we could use haskell's laziness to make (3) a reality though! |
Ouch. I'm sorry. Your question requires more than a 5min answer, that how it ended up slipping my mind. I'll give my thoughts by tomorrow (Saturday) night. |
Ok, I'm back. Yes, your point is a very good one. I was, ironically, thinking in terms of mutable data structures, in which case there is no problem of going back in time. I think that there are 3 possible attitudes that we can take. Well, kind of 4, but the fourth one is quite a bit of a stretch.
I can't ansewr for you which attitude you should have to this. It's a design question, and depends on where you want to bring this library. It's up to you to choose what serves your purpose best. |
Small update: I've taken a detour into reading Okasaki's book whose ideas are sounding really interesting. I'll attempt to make the e-graph emulate laziness and use some of its ideas in it. Some variation of (2) right now is the most appealing to me. I'm trying to implement https://dl.acm.org/doi/pdf/10.1145/3485496 at the moment, and intend on trying some other related projects. I hope to experiment a little bit more with the user side of the library to help me in making these decisions a little bit better. Thanks again! Note from #1
I sent out an e-mail regarding this! |
eb291c6
to
d2862ab
Compare
Closes #1
Work in progress (documentation missing)I realize I'm still not 101% convinced.I do realize the price to pay for the safefind
if the e-graph is already rebuilt is minimal, but perhaps I'm still hung up on that.Currently, our only consumer of
find
is inExtraction
here and hereIt feels a bit weird that the e-graph is being rebuilt everytime find is called since it's being done so many times.The performance difference isn't noticeable though.