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

Clarify array equality #803

Merged
merged 2 commits into from
Apr 12, 2024
Merged

Clarify array equality #803

merged 2 commits into from
Apr 12, 2024

Conversation

verdammelt
Copy link
Member

@verdammelt verdammelt commented Apr 3, 2024

The test data and instructions could have led to confusion.

The previous instructions and code could lead someone to believe that an equality predicate other than equalp could work for the "loosely" function. However even with the previous test data that could not be since all equality predicates but equalp only consider arrays equal if they are eq. Only equalp checks the contents of the array for equality.

The mention of numeric type (and then not showing it in the test) was an unintentional red herring.

Both the test data and the instructions have been changed to (hopefully) make things clearer.

Fixes #798

[no important files changed]

Having `+an-array+` and `+a-similar-but-different-array+` *looking*
like the same array led to the possible misconception that anything
other than `equalp` would work

`eq`, `eql` and `equal` all treat arrays as equal only if they `eq`.

`equalp` treat arrays as equal if they are of the same size and their
elements are `equalp`.

So only `equalp` would work since `+an-array+` and
`+a-similar-but-different-array+` were not `eq` even though they
looked the same. Making them *more* dissimilar removes the possible
confusion.
@verdammelt verdammelt force-pushed the improve-equality-concept-exercise branch from a2fcbaa to 56199c7 Compare April 12, 2024 23:13
@verdammelt verdammelt merged commit dc30488 into main Apr 12, 2024
5 checks passed
@verdammelt verdammelt deleted the improve-equality-concept-exercise branch April 12, 2024 23:16
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

Successfully merging this pull request may close these issues.

key-comparison maze of arrays unclear test of identity or internal structure
1 participant