Suggest `match` with `regexp` instead of `regexp-match`
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 領域
- tooling
調査の方向性
リンクされている drracket/browser/private/html.rkt の例と、提供されている resyntax/test のテストケースから始め、次に推奨機能の実装と regexp-match および match パターンに関する既存のテストを見つけてください。示されているテストがパスし、名前のない複数のキャプチャグループを含むケースや lambda ではない分岐が引き続き推奨されない状態になれば完了です。
索引モデルが issue の本文から書いたものです。
説明
In this code, the use of cond and regexp-match can be expressed more cleanly using match with the regexp pattern. This probably shouldn't be rewritten unless 1) every non-else branch of the cond is using the lambda-based form and 2) all of the match patterns use define to name the extracted groups, if there are multiple groups. So this test case ought to pass:
#lang resyntax/test
require: resyntax/default-recommendations default-recommendations
header:
- #lang racket
test: "original code should be refactorable to new code"
--------------------
(define re #rx"^[ \t\n]*([0-9]+)[ \t\n]*,(.*)$")
(define (f str)
(cond
[(regexp-match re str)
=>
(lambda (m)
(define a (cadr m))
(define b (caddr m))
(list a b))]
[else 'else]))
====================
(define re #rx"^[ \t\n]*([0-9]+)[ \t\n]*,(.*)$")
(define (f str)
(match str
[(regexp re (list _ a b)) (list a b)]
[else 'else]))
--------------------
There are some similar cases in DrRacket's codebase but refactoring all of them is questionable. The cases where there's multiple capture groups and none of them have named variables associated with them ought to be left alone.
- 主要言語
- Racket
- スター
- 70
- フォーク
- 11
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
jackfirth/resyntax のほかの issue
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
documentation
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
-
testing
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
-
testing
難易度 3/5 1〜2日 初心者へのやさしさ 75/100
-
testing
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
jackfirth/resyntax の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · コメント 1 件 ·
-
good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
rust-bitcoin/rust-bitcoin#6930 · コメント 1 件 ·
-
Solved site promotion gate fails on runner PHP patch drift (expects 8.2.33, runner installs 8.2.34) オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Automattic/blocks-engine#2161 ·