Adriandmen / 05AB1E

A concise stack-based golfing language
MIT License
760 stars 48 forks source link

Sort `{` acts weird in some cases (even though `Σ}` works fine) #198

Open kcruijss opened 1 year ago

kcruijss commented 1 year ago

Not sure how to explain it, but { didn't sort a list of lists in expected lexicographical order in one of my programs, even with --no-lazy compiler flag. And the weirdest part is that Σ} (sort-by builtin without implementation) does sort correctly as expected.

Not sure if it's relevant (it probably is), but I've used ā._Dí« beforehand to get all rotations and reflections of the list.

Try it online to reproduce.
Found in this 05AB1E answer of mine.

monkeygroover commented 1 year ago

I think this may already be fixed? I can't repro using the code from master, the TIO version isn't up to date.

monkeygroover commented 1 year ago
echo "[1,3,4,2]" | osabie sort.abe                                     
Current:  [[3, 4, 2, 1], [4, 2, 1, 3], [2, 1, 3, 4], [1, 3, 4, 2], [1, 2, 4, 3], [3, 1, 2, 4], [4, 3, 1, 2], [2, 4, 3, 1]]
Expected: [[1, 2, 4, 3], [1, 3, 4, 2], [2, 1, 3, 4], [2, 4, 3, 1], [3, 1, 2, 4], [3, 4, 2, 1], [4, 2, 1, 3], [4, 3, 1, 2]]
Actual:   [[1, 2, 4, 3], [1, 3, 4, 2], [2, 1, 3, 4], [2, 4, 3, 1], [3, 1, 2, 4], [3, 4, 2, 1], [4, 2, 1, 3], [4, 3, 1, 2]]
kcruijss commented 1 year ago

Ah. Maybe I should contact ATO to support (the latest version of) 05AB1E, since TIO isn't being updated anymore since Dennis left codegolf.stackexchange.com.