namin / staged-miniKanren

staged relational interpreters: running with holes, faster
125 stars 16 forks source link

Eliminate a relation call and re/destructuring pattern match? #5

Closed jasonhemann closed 3 years ago

jasonhemann commented 3 years ago

It looks to me like, knowing that what you have is a cons, you can specialize the code in these cases to the non-variable cons case, and avoid restructuring the list of clauses. Am I missing something?

https://github.com/namin/staged-miniKanren/blob/4b2dff8952dcdc351fab32751f29f093330291a8/staged-interp.scm#L592

namin commented 3 years ago

Yes, I think you can do that. I just wanted to keep the logic the same. You only save one bit of the recursive call each time.