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

Juxt

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

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

評価

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

調査の方向性

Operators モジュールから始め、既存の sequence、item、uncurry、uncurryN 関数を調べて、それらの命名と構成に合わせます。提案されている juxt2、juxt3、juxt4 のバリアントを実装し、その後タプルを生成する例のカバレッジを追加して、プロジェクトのテストが通ることを確認します。

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

説明

enhancement RFC

Hello and thank you for creating F#+! I'd like to propose adding juxtapose functions to the Operators module. These functions are defined as follows:

let juxt2 f g x = f x, g x
let juxt3 f g h x = f x, g x, h x
let juxt4 f g h i x = f x, g x, h x, i x
// etc

This function is called juxt in Clojure and the Python toolz library. I believe this function was first introduced by John Backus in his paper called Can programming be liberated from the von Neumann style? where it was called construction.

In Haskell and F#+ there's a similar function called sequence. Unfortunately, it returns a list and not a tuple, forcing all the result types to be the same.

juxt in combination with item and uncurry/uncurryN make point-free programming with tuples easier. Here are some examples:

open FSharpPlus

// Basic examples
let square: float -> float =
    juxt2 id id >> uncurry ( * )

let avg: list<float> -> float =
    juxt2 List.sum (List.length >> float) >> uncurry (/)

// Grouping and ungrouping tuples
let ``(a,b),c``   (a,b,c)   = (a,b),c
let ``~(a,b),c~`` ((a,b),c) = a,b,c

``(a,b),c``(1,2,3)     = (juxt2 (juxt2 item1 item2) item3)(1,2,3) // ((1, 2), 3)
``~(a,b),c~``((1,2),3) = (juxt3 (item1 >> item1) (item1 >> item2) item2)((1,2),3) // (1, 2, 3)

Please let me know if this function already exists in F#+ (or F# for that matter) and I missed it. Thank you!

主要言語
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 を短くまとめたダイジェスト。