retrie icon indicating copy to clipboard operation
retrie copied to clipboard

[discussion] list literal manipulation

Open 414owen opened this issue 4 years ago • 4 comments

:wave: Hi, It would be really useful to be able to manipulate list literals as their cons-list counterparts. I'm guessing this isn't supported because retrie doesn't run the desugarer?

414owen avatar Dec 17 '20 17:12 414owen

Hi @414owen!

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.

In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

facebook-github-bot avatar Dec 17 '20 17:12 facebook-github-bot

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

facebook-github-bot avatar Dec 17 '20 17:12 facebook-github-bot

Ah, I understand now, thank you for taking the time to submit the example.

I'm afraid that you are right, retrie doesn't run the desugarer. In fact, it doesn't even run the renamer! I very much wish it did run the renamer at least, but I think the desugarer is probably out of scope since I don't think that it is possible to reconstruct the user program back after desugaring and transforming.

pepeiborra avatar Dec 17 '20 17:12 pepeiborra

It's possible to build this sort of thing (equivalence between list forms) as a special case, but in general, equivalence in retrie is syntactical modulo alpha-equivalence because we only run the parser.

Thanks for the test case... I'll throw together a patch and we can discuss. We already do something like this for $... I have ideas for generalizing the implementation a bit, but haven't pursued it yet.

xich avatar Dec 17 '20 20:12 xich