leanprover-community / leanprover-community/mathlib4

Inconsistent parameter ordering in `List.Vector.insertIdx` and `List.insertIdx`

Open
#32,394 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lean
Stars
4.2k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

For List in Lean:

def insertIdx (xs : List α) (i : Nat) (a : α) : List α

For List.Vector in Mathlib:

def insertIdx (a : α) (i : Fin (n + 1)) (v : Vector α n) : Vector α (n + 1)

The orders of the index parameter i, the value parameter a, and the list/vector parameter xs and v are inconsistent. Should this be fixed?

From https://github.com/leanprover-community/mathlib4/pull/29400#discussion_r2584528551.

Contributor guide

Open the 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.

Research direction

Compare the parameter order in the quoted List.insertIdx and List.Vector.insertIdx definitions, then read the referenced pull-request discussion for the intended direction. Search for usages of both entry points and identify the tests or callers that would need updating; done means the ordering decision is agreed and the affected API and usages are consistent.

Written by the indexing model from the issue text.

Assessment

Domain
developer-experience
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.