Macaulay2 / Macaulay2/M2

Order of arguments (for "drop", "take", etc.)

Open
#1,630 12 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

Is there a reason why the order is drop(BasicList, ZZ) and not drop(ZZ, BasicList)? The most common use-case I have is to e.g. remove the last elements in a nested list, e.g. if
```
L = {{1,2},{1,0,3},{2,4},{3,5}}
```
then currently one has to write
```
apply(L, x -> drop(x, -1))
```
If the order were reversed, then one could take advantage of the subscripted syntax for functions with multiple arguments to instead write
```
L/drop_(-1)
```
This is actually a special case of a much more general feature request I have thought about, which is to have M2 accept arguments in any order as long as the arguments have all distinct types. I think even a naive implementation of this would greatly increase the user-friendliness, without inducing a noticeable performance hit (since functions only accept at most 4 arguments). Are there any drawbacks to this?

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

Start by reviewing the issue's examples for drop, take, apply, and subscripted syntax, then inspect how M2 currently handles argument order and multi-argument functions. Done requires an agreed scope for the general feature, including its drawbacks and implementation boundaries; no source files or tests are named in the issue.

Written by the indexing model from the issue text.

Assessment

Domain
developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.