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

Alias expression #28

Open
Specy opened this issue Jan 25, 2025 · 1 comment
Open

Alias expression #28

Specy opened this issue Jan 25, 2025 · 1 comment

Comments

@Specy
Copy link
Owner

Specy commented Jan 25, 2025

create syntax for aliases, something like

min $cost
s.t.
    alias $cost = ...

    $cost >= 200

Where the aliases are the first thing scanned and they will be replaced at build time by simply replacing the expression inside of the alias (this might cause issues with the type checker though, the return value of the alias must be the same as the return value of the expression, at that point we can typecheck the aliases before checking the constraints and objective function)

@Specy
Copy link
Owner Author

Specy commented Jan 29, 2025

And why not, generics too so you can do things like

alias $double<i> = x_i * 2

$double(i) <= 10 for i in 0..10

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

No branches or pull requests

1 participant