Skip to content
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

allow human readable names for terms #7

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sbelizaire
Copy link
Collaborator

No description provided.

src/main.rs Outdated
}
.into(),
);
program.apply_term(&term);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe what apply_term does is wraps the program in an Apply, which passes term as the argument; this isn't what you want here.

Since traverse_uplc_with gives you a mutable reference to the term, you can just mutate the name on the existing term;

So, you'll need a hashmap<int, string>; any time you encounter something with a name attached, check if name.unique is in the hashmap; if so, use whatever name is there; otherwise generate a new name, and store it in the hashmap, then use that for the name.

I think the main place you'll use this is in vars and lambdas.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From there, we can prepopulate the hashmap with things we know the user has re-mapped, and re-run the program through this process.

@sbelizaire sbelizaire requested review from Quantumplation and removed request for Quantumplation April 16, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants