jackfirth / jackfirth/resyntax

(apply + (map ...)) -> for/sum

Open
#231 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

existing lint
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

Open the contributing guide

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.