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

Map equality should respect insertion order #21

Open
metametadata opened this issue Jul 12, 2024 · 0 comments
Open

Map equality should respect insertion order #21

metametadata opened this issue Jul 12, 2024 · 0 comments

Comments

@metametadata
Copy link

Insertion order is a crucial property of the data structure and it's counterintuitive that on equality the order is not respected. It has bit me several times when I was writing unit tests for my code.

Steps

Evaluate:

(= (linked/map 1 2
               3 4)
   (linked/map 3 4
               1 2))

Expected

false.

Actual

true.

Workaround

Convert linked maps to seqs prior to comparison:

(= (seq (linked/map 1 2
                    3 4))
   (seq (linked/map 3 4
                    1 2)))
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