Macaulay2 / Macaulay2/M2

sorting bags changes order

Open
#3,719 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Core
Dominant language
Macaulay2
Stars
435
Forks
297
Avg merge
4d 20h
Merged PRs (30d)
11

Description

My understanding is that the whole point of the type `Bag` is the following line:
```m2
Bag ? Bag := (x,y) -> incomparable -- so we can sort with them
```
But this causes orders to change:
```m2
i64 : last \ sort \\ Bag \ {{2}, {3}}

o64 = {3, 2}
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Bag comparison declaration (`Bag ? Bag := (x,y) -> incomparable`) and reproduce the `last \ sort \ Bag \ {{2}, {3}}` example. Trace how `incomparable` is handled by `sort`, then clarify the intended ordering before changing behavior. Done should include a check that sorting bags does not unexpectedly change their order.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.