Description text of `difference`

Open
#246 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
55/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Stale
Domain
documentation

Research direction

Read the difference documentation linked in the issue and compare its wording with the provided example. Clarify that each element in the second array is matched and removed from the first array from left to right; done when the description explains why the result is [1].

Written by the indexing model from the issue text.

Description

Example:

difference [2, 1, 2] [2, 2, 3] == [1]

https://pursuit.purescript.org/packages/purescript-arrays/7.3.0/docs/Data.Array#v:difference

Delete the first occurrence of each element in the second array from the first array, creating a new array.

I read the description as follows:

  • each element in the second array: 2, 2, 3
  • first occurrence of each element in the second array: 2, 3
  • delete [2,3] from the first array: [2,1,2] ---> deleting [2,3] ---> [1,2]

This would be a clearer description of what this function does:

For each element in the second array, find an occurrence from left to right in the first array and remove it when found.

I think the word "first" should be avoided, because in the example above then second 2 from [2,2,3] is matched against the second 2 from [2,1,2].

Dominant language
PureScript
Stars
58
Forks
70
Avg merge
2d 22h
Merged PRs (30d)
1

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from purescript/purescript-arrays

All issues in purescript/purescript-arrays

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.