[API Proposal]: Extend the reduce and reduceBack to Collections
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- fsharp
調査の方向性
まず、既存のreduce関数の実装と、41件のコメントがある議論を読み、未解決のAPI上の懸念を理解します。提案されているreduceおよびreduceBackのシグネチャを、list、array、seqのネイティブ操作と比較します。完了条件は、汎用コレクションと空の入力時の動作を対象とする、合意済みの設計と概念実証です。
索引モデルが issue の本文から書いたものです。
説明
Background and motivation
From the requirements point of view: the fold function must provide init, reduce does not require init, which means no longer needs to write boilerplate "match with" code like "extract the first element from generic Collections as init, the remaining elements as sequence, and then pass it to fold".
From a reasonable point of view: list/array/seq all provide native reduce methods, list/array also provides native reduceBack methods. This generic encapsulation is not difficult to implement, and other languages (except fundamental FPs like Haskell) generally provide reduce methods, which is reasonable.
I know there is a reduce function implementation now, but that one is very difficult to use. To be honest, I have no idea how to pass parameters.
API Proposal
let inline reduce (folder: 'State->'T->'State) (foldable: '``Foldable<'T>``) : 'State
let inline reduceBack (folder: 'T->'State->'State) (foldable: '``Foldable<'T>``) : 'State
API Usage
reduce (*) [1; 2; 3; 4; 5] |> should equal 120
reduce (+) ([]: int list) // throws an exception
Alternative Designs
No response
Risks
No response
Are you willing to help with a proof-of-concept (as PR in that or a separate repo) first and as pull-request later on?
Yes, please assign this issue to me.
- 主要言語
- F#
- スター
- 942
- フォーク
- 105
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
fsprojects/FSharpPlus のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
fsprojects/FSharpPlus#684 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
fsprojects/FSharpPlus#683 · コメント 1 件 · リアクション 2 件 ·
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
fsprojects/FSharpPlus#678 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
fsprojects/FSharpPlus#644 ·
-
breaking change F#+ v2.0
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
fsprojects/FSharpPlus#643 ·
fsprojects/FSharpPlus の issue をすべて見る
似ている issue
-
Laptop display stays disabled after unplugging external monitor: FALLBACK output counted as externalオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 1 日以内に返信
-
[scanner] check-community-group-links rewrites report with fresh checkedAt when every upstream check fails対応中かも @hivecommons-hive が今日担当しました。 オープンagent/scanner bug hive/covered-by-pr hive/hosted-available-lke648397-260827-5n31
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
semantic-reasoning/wirelog#2163 ·
メンテナーはふだん 1 日以内に返信
-
beginner friendly community contributions-welcome data-structures good first issue hacktoberfest help wanted up-for-grabs
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
メンテナーはふだん 1 日以内に返信
-
Hermes: /ponytail off never reaches the model, the ruleset stays active対応中かも @szsunyuan が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
DietrichGebert/ponytail#1121 ·
メンテナーはふだん 3 日以内に返信