Skip to content

Map equality should respect insertion order #21

Description

@metametadata

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)))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions