CountsBy

CountsBy[{e1,e2,},f]

キーが f[ei]の明確な値であり,値がこれらの f[ei]の値が現れる回数を与える連想を与える.

CountsBy[f]

式に適用可能なCountsByの演算子形を表す.

詳細

  • CountsBy[{e1,e2,},f]は,キー f[ei]が対応する eiが最初に現れる順である連想を与える. »
  • CountsBy[f][expr]CountsBy[expr,f]に等しい.

例題

すべて開くすべて閉じる

  (2)

リスト中の偶数要素と奇数要素を数える:

リスト中の素数と合成数を数える:

CountsByの演算子形を使う:

スコープ  (1)

同じ絶対値を持つ要素を数える:

演算子形を使って数える:

特性と関係  (2)

結果中の要素は,f[ei]の値がリストに最初に現れた順に現れる:

リストの要素を逆転させると回数順も逆になる:

0をリストの末尾に移動して再度出現回数を生成する:

CountsBy[list,f]は,事実上,Counts[Map[f,list]]である:

Wolfram Research (2014), CountsBy, Wolfram言語関数, https://reference.wolfram.com/language/ref/CountsBy.html.

テキスト

Wolfram Research (2014), CountsBy, Wolfram言語関数, https://reference.wolfram.com/language/ref/CountsBy.html.

CMS

Wolfram Language. 2014. "CountsBy." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CountsBy.html.

APA

Wolfram Language. (2014). CountsBy. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CountsBy.html

BibTeX

@misc{reference.wolfram_2025_countsby, author="Wolfram Research", title="{CountsBy}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/CountsBy.html}", note=[Accessed: 02-April-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_countsby, organization={Wolfram Research}, title={CountsBy}, year={2014}, url={https://reference.wolfram.com/language/ref/CountsBy.html}, note=[Accessed: 02-April-2025 ]}