jackfirth / jackfirth/resyntax
(apply + (map ...)) -> for/sum
Nobody has claimed this yet.
- Dominant language
- Racket
- Stars
- 70
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
E.g.
(apply + (map length '((1) (2 3))))
is equivalent to
(for/sum ([x (in-list '((1) (2 3)))])
(length x))
More generally:
(apply + (map f xs))
is equivalent to
(for/sum ([x (in-list xs)])
(f x))
But the latter doesn't create an intermediate data structure, so it's better.
Probably can do the same with filter.
Contributor guide
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 locating the refactoring rules or entry points that handle apply, map, and for/sum expressions; no file or test path is named in the issue. Check existing tests for equivalent transformations, then add coverage showing the stated apply/map form becomes for/sum without an intermediate data structure. Treat the possible filter transformation as separate scope unless the project indicates otherwise.
Written by the indexing model from the issue text.
Assessment
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100