Macaulay2 / Macaulay2/M2

Better list comprehension

Open
#3,185 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Sometimes writing `sum apply(L, a -> f(a))` gets too tedious, so we have defined syntax like `sum(L, a -> f(a))`. However, doing this to every similar function (e.g. `directSum`) is also tedious.

Can we allow something like `{ f : L }` to mean the same thing as `apply(L, f)`, so that we can write something like this, for instance?
```m2
N = directSum { a -> M(a) : 0..5 }
```
I think the precedence for `:` and `->` might need to be adjusted.

Alternatively, a flipped for loop like this might be nice:
```m2
N = directSum list M(a) for a from 0 to 5
```

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 examining the existing syntax for sum, apply, directSum, and the precedence of `:` and `->`; no source file or test is named in the issue. The work is done when an agreed comprehension form is implemented and the proposed directSum example parses and behaves as intended.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.