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

Refactor numerics with higher-order functions #118

Merged
merged 3 commits into from
Aug 29, 2024
Merged

Refactor numerics with higher-order functions #118

merged 3 commits into from
Aug 29, 2024

Conversation

rossberg
Copy link
Collaborator

There is a lot of code duplication in the numerics implementation. This PR simplifies that by factoring out much of the logic into higher-order functions. This is just a start, we can probably simplify further.

However, this is the first use of def's as parameters, which the interpreter does not support yet.

@ShinWonho, @f52985, this PR isn't high priority. Just putting it out there so that you can have a look in case you have spare cycles. :)

@f52985
Copy link
Collaborator

f52985 commented Aug 28, 2024

Now the interpreter backends support the def parameter!

To keep it simple,
instead of maintaining a new environment,
it uses the original env that interpreter was using,
where key is the concatenation of the prefix $ and the parameter name (i.e. "$f_"),
and the value is the name of the original target function definition. (i.e. FnameV("fadd_"))

This is based on the assumption that the normal variables in SpecTec never starts with "$".

@rossberg
Copy link
Collaborator Author

Cool, thanks @f52985!

@rossberg rossberg merged commit d9a12cf into main Aug 29, 2024
1 check passed
@rossberg rossberg deleted the ho-num branch August 29, 2024 07:01
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