michaelballantyne / hosted-minikanren

An optimizing compiler implementation of miniKanren for Racket
MIT License
2 stars 2 forks source link

Remove unused logic variables #8

Closed gamburgm closed 3 years ago

gamburgm commented 3 years ago

Don't freshen logic variables that aren't referenced. For example, transform:

(fresh (a b c d)
    (== a '())
    (conso c a '(1 2 3)))

into:

(fresh (a c)
    (== a '())
    (conso c a '(1 2 3)))

This pass does not eliminate freshes if they're empty, as that's not semantics preserving.