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

attributes are not sorted in the output formula #593

Closed
yegor256 opened this issue Nov 30, 2024 · 5 comments
Closed

attributes are not sorted in the output formula #593

yegor256 opened this issue Nov 30, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@yegor256
Copy link
Member

When a formula is printed after rewrite command, attributes in bindings are not sorted (if I'm not mistaken). This causes confusion while testing. I suggest sorting them alphabetically.

@yegor256
Copy link
Member Author

@deemp please, check

@deemp
Copy link
Member

deemp commented Dec 3, 2024

@fizruk, please check.

I see two ways to implement this:

  1. Use ordered maps instead of lists in the AST
    Formation. Object ::= "⟦" [Binding] "⟧" ;
    Application. Object ::= Object "(" [Binding] ")" ;
  2. Recursively traverse an expression and sort attributes before printing

What can be other ways? Which one is more preferrable?

@fizruk fizruk added the enhancement New feature or request label Dec 4, 2024
@fizruk
Copy link
Collaborator

fizruk commented Dec 4, 2024

@yegor256 ordering is important for void attributes (since $\alpha_i$ in applications explicitly refer to that order). We can sort attached attributes, however.

@deemp It might be best to use Map for attached attributes (and then do toAscList), but void attributes need to retain order as specified in the source code (so use lists).

@yegor256
Copy link
Member Author

yegor256 commented Dec 4, 2024

@fizruk no matter what algorithm you use in sorting, it will work. We just need persistency between between versions of normalizer.

@yegor256
Copy link
Member Author

@fizruk let's close this, in favor of this: #629

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants