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

Add mapper statements #465

Closed
developedby opened this issue May 23, 2024 · 0 comments · Fixed by #529
Closed

Add mapper statements #465

developedby opened this issue May 23, 2024 · 0 comments · Fixed by #529
Assignees
Labels
enhancement New feature or request syntax About Bend's syntax

Comments

@developedby
Copy link
Member

For assignments

x @= f

Desugars to

x = (f x)

And also for map access

x[k] @= f

Desugars to

x = (Map/map x k f)

Where Map/map does get and then set, but without having to duplicate anything.

Then, we can implement in-line operators for maps using Map/map

x[k] += n

Desugars to

x = (Map/map x k @x (+ x n))

Maybe later we can add specialized adder, etc functions for better performance, but for now this is enough.

@developedby developedby added enhancement New feature or request syntax About Bend's syntax labels May 23, 2024
@imaqtkatt imaqtkatt self-assigned this May 29, 2024
@imaqtkatt imaqtkatt linked a pull request May 29, 2024 that will close this issue
github-merge-queue bot pushed a commit that referenced this issue May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request syntax About Bend's syntax
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants