ComapApply[{f1,f2,…},expr]
ComapApply[fs]
表示可应用于表达式的 ComapApply 运算符形式.
ComapApply
ComapApply[{f1,f2,…},expr]
ComapApply[fs]
表示可应用于表达式的 ComapApply 运算符形式.
更多信息和选项
- ComapApply 通常用于将函数列表中的每个函数应用于相同的参数序列. »
- 通过选项设置 HeadsTrue,ComapApply 包括表达式的标头及其部分. »
- ComapApply 总是有效地构造一个完整的新表达式,然后对其求值. »
- ComapApply[fs,expr] 中 fs 的标头不必是 List.
- 如果 fs 是 Association 对象,则 ComapApply[fs,expr] 将 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]]当 fi 无属性时,ComapApply[{f1,f2,…},expr] 等价于 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 语言. 2024. "ComapApply." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/ComapApply.html.
APA
Wolfram 语言. (2024). ComapApply. Wolfram 语言与系统参考资料中心. 追溯自 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: 12-October-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: 12-October-2026]}