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

Duplication checker: itself self-explanatory, text around it confusing #81

Open
keithb-coop opened this issue Mar 22, 2024 · 0 comments

Comments

@keithb-coop
Copy link

keithb-coop commented Mar 22, 2024

Description

The writing specifications page says this of the duplication checker:

  1. Create an empty set seen, then step through the elements of seq.

  2. Every time we see a number, we check if it's already in seen.

    • If it is, we say the list is not unique.
    • Otherwise, we add the element to seen and continue.
  3. If we reach the end and haven't seen any duplicate elements, we say the list is unique.

  4. Our decision should match the operator IsUnique(seq).

In this chapter we'll focus on just writing out the spec, parts (2) and (3). In the next chapter we'll do steps (1) and (4), actually verifying the algorithm.

But the example plainly does do steps 1, 2, 3. Does the segment

In this chapter we'll focus on just writing out the spec, parts (2) and (3). In the next chapter we'll do steps (1) and (4), actually verifying the algorithm.

perhaps refer to an earlier list of activities that the user is to do?

problem statement

Suggest that IsUnique(seq) is a misleading name, and that something like ContainsNoDuplicates(seq) expresses the intent better. Similarly, if we reach the end and haven’t seen any duplicate elements, we might better say the elements of the list is are unique.

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