Better list comprehension
Nobody has claimed this yet.
- 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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