double "for" loop
- Dominant language
- Macaulay2
- Stars
- 435
- Forks
- 297
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 11
Description
Should we have a syntax
```
for x in X, y in Y list f(x,y)
```
(similar to python)
instead of the current
```
flatten for x in X list for y in Y list f(x,y)
```
which wastes a lot of time creating tons of nesting lists and then flattening the whole thing.
You can check with
```
time(for i in l list for j in l list {i,j};)
```
vs
```
time(flatten for i in l list for j in l list {i,j};)
```
that half the time is spent flattening.
I can try to implement this if there's some interest.
Somewhat related: #3971 (would help implement that too)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the two timing examples in the issue and reading the related discussion in #3971. Then identify the parser and evaluator entry points for the existing nested `for` syntax; done means the proposed double-`for` form is agreed, implemented, and avoids the intermediate nesting and flattening cost.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100