Skip to content

Description text of difference #246

@flip111

Description

@flip111

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].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions