Macaulay2 / Macaulay2/M2

Support O(1) insert/prepend/swap for MutableList

Open
#1,608 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Core
Dominant language
Macaulay2
Stars
435
Forks
297
Avg merge
4d 20h
Merged PRs (30d)
11

Description

A List is a list of fixed length with some objects and modifying it requires creating a new list. From the name "mutable list" one might read that they allow other modifications, some natural ones being append/prepend as well as insert/permute.

In conversation with Dan, it came up that MutableLists are implemented as vectors in order to allow for O(1) access, but perhaps a new type of MutableHashTable with integer keys and identity hash function should be used for that purpose, which may be called a MutableVector, which is semantically closer to the C++ concept of "vector".

Then, a MutableList can be reimplemented to be a linked list data structure, which is closer to the C++ concept of "list", with modification methods mentioned above.

I think O(1) insertion would definitely be used to speed up programs.

Contributor guide

No contributing guide indexed for this repository

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

No files, tests, or entry points are named. Start by locating the current MutableList implementation and its vector representation, then review the proposed MutableVector and linked-list alternatives. Done requires an agreed design for O(1) insert, prepend, and swap, plus the corresponding implementation.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.