Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Add more string functions - StringBuilder extension

オープン
#166 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
fsharp
領域
tooling

調査の方向性

fsprojects/FSharpPlus issue 158 にリンクされている議論から始め、そこで提案されている StringBuilder 拡張を cannorin/prelude.fs のリファレンス実装と比較してください。既存の String.fs と拡張の構成を確認し、そのうえで String.build と printf および printfn が合意されたスコープかどうかを判断してください。完了とは、選択された関数が一致する動作とカバレッジで利用可能になっていることを意味します。

索引モデルが issue の本文から書いたものです。

説明

Description

https://github.com/fsprojects/FSharpPlus/issues/158#issuecomment-512607693

For the StringBuilder extension, it will be used like below with the String.build function from my String.fs:

let s =
  String.build (fun builder ->
    builder.printfn "%s" "hello"
    builder.printfn "%i%i" 4 2
    ...
  )

The motivation to use this extension is to avoid the repetitive use of ignore caused by the fact StringBuilder's Write and WriteLine returns the StringBuilder for method chaining. Also, sb.WriteLine(sprintf "%i" 42).WriteLine(sprintf "%s" "foo").ToString() looks odd and ugly imo, but this might be just a personal impression.

https://github.com/fsprojects/FSharpPlus/issues/158#issuecomment-512721780

the build and the StringBuilder functions looks nice to me, but let's open another issue for StringBuilder extensions as at the moment we don't have any of them, and it might require more discussion.

Referece implementation:

From cannorin/prelude.fs:


let build (builder: StringBuilder -> unit) =
  let sb = new StringBuilder()
  builder sb
  sb.ToString()

type StringBuilder with
  member inline this.printf format =
    Printf.kprintf (fun s -> this.Append s |> ignore) format

  member inline this.printfn format =
    Printf.kprintf (fun s -> this.AppendLine s |> ignore) format
主要言語
F#
スター
941
フォーク
106
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fsprojects/FSharpPlus のほかの issue

fsprojects/FSharpPlus の issue をすべて見る

似ている issue

DevTools の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。