ComapApply[{f1,f2,…},expr]
ComapApply[fs]
式に適用可能なComapApplyの演算子形を表す.
ComapApply
ComapApply[{f1,f2,…},expr]
ComapApply[fs]
式に適用可能なComapApplyの演算子形を表す.
詳細とオプション
- ComapApplyは,リスト中の各関数を引数の同じシーケンスに適用するためによく使われる. »
- ComapApplyは,オプション設定がHeadsTrueのときは式の頭部とその部分を含む. »
- ComapApplyは,常に事実上完全な新しい式を構築してこれを評価する. »
- ComapApply[fs,expr]中の fsの頭部はListではなくてもよい.
- ComapApply[fs,expr]は fsがAssociationオブジェクトのときは expr の頭部を連想中の値で置換する. »
- ComapApply[fs][expr]はComapApply[fs,expr]に等しい.
- Parallelize[ComapApply[fs,expr]]はComapApply[fs,expr]をすべてのサブカーネルで並列に計算する. »
例題
すべて開く すべて閉じる例 (3)
ComapApply[{f, g, h}, {1, 2}]ComapApplyの演算子形を使う:
ComapApply[{f, g, h}][{1, 2, 3}]ComapApply[<|"a" -> f, "b" -> g, "c" -> h|>, {x, y}]スコープ (3)
ComapApply[{1 + f[#, #2]&, 2 + g[#, #2]&, 3 + h[#, #2]&}, {1, 2}]ComapApply[{{x, y} |-> x + y, {x, y} |-> x y}, {3, 4}]ComapApplyは任意の頭部を持つ式に使うことができる:
ComapApply[f[a, b], g[x, y]]式の頭部をAssociationの値で置換する:
ComapApply[<|"a" -> f, "b" -> g|>, {1, 2}]オプション (1)
特性と関係 (8)
ComapApplyは式の頭部を他の式の一部で連続的に置換する:
ComapApply[{f, g, h}, head[x, y]]MapApplyは式の各部分の頭部を他の式で置換する:
MapApply[f, {head[x, y], head[a, b], immaterial[1, 2]}]Through[p[f,g,…][x,y,…]]はComapApply[p[f,g,…],{x,y,…}]に等しい:
Through[{f, g, h}[x, y, z]]ComapApply[{f, g, h}, {x, y, z}]これをComapApplyの演算子形と比較する:
ComapApply[{f, g, h}][{x, y, z}]p[f,g,…][x,y,…]に値がないときはComapApply[p[f,g,…],{x,y,…}]を使うことができる:
ComapApply[<|"a" -> f, "b" -> g|>, {x, y, z}]p[f,g,…][x,y,…]に値があるときはThroughを使うことはできない:
<|"a" -> f, "b" -> g|>[x, y, z]Through[<|"a" -> f, "b" -> g|>[x, y, z]]ComapApply[{f1,f2,…},expr]は fiに属性がないときはMap[f|->Apply[f,expr],{f1,f2,…}]に等しい:
ComapApply[{f, g, h}, {x, y}]Map[e |-> Apply[e, {x, y}], {f, g, h}]ComapApplyは式の頭部を評価することなしにホールドされた式の一部で置換することができる:
ComapApply[Hold[Plus, Times], {2, 3, 4}]ReleaseHoldを使って評価が行われるようにする:
ReleaseHold[{%}]いくつかの引数がホールドされているだけなら,それらの引数の評価だけが行われなくなる:
SetAttributes[h, HoldRest]ComapApply[h[Plus, Times], {2, 3, 4}]Unevaluatedを使って式の頭部を評価せずに他の式で置換する:
ComapApply[{f, g}, Unevaluated[a + b + a]]ComapApply[{f, g}, a + b + a]Unevaluatedを使って式の頭部を他の式の一部で評価せずに置換する:
ComapApply[Unevaluated[f g f], {1, 2}]ComapApply[f g f, {1, 2}]ComapApplyは自動的に並列化できる:
Parallelize[ComapApply[{f, g, h}, {1, 2}]]テクニカルノート
関連するガイド
-
▪
- 関数型プログラミング ▪
- 関数の合成と演算子形式 ▪
- 式への構造操作
テキスト
Wolfram Research (2024), ComapApply, Wolfram言語関数, https://reference.wolfram.com/language/ref/ComapApply.html.
CMS
Wolfram Language. 2024. "ComapApply." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ComapApply.html.
APA
Wolfram Language. (2024). ComapApply. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ComapApply.html
BibTeX
@misc{reference.wolfram_2026_comapapply, author="Wolfram Research", title="{ComapApply}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/ComapApply.html}", note=[Accessed: 14-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_comapapply, organization={Wolfram Research}, title={ComapApply}, year={2024}, url={https://reference.wolfram.com/language/ref/ComapApply.html}, note=[Accessed: 14-September-2026]}