KeyMap

KeyMap[f,key1val1,key2val2,]

f 映射于一个关联的键上,给出 f[key1]val1,f[key2]val2,.

KeyMap[f]

表示可以应用于表达式的 KeyMap 的运算符形式.

更多信息

  • 如果有相同的 f[keyi],用后出现的关联的值代替前面的. »
  • KeyMap[f][expr] 等价于 KeyMap[f,expr].
  • Parallelize[KeyMap[f,key1val1,key2val2,]] 在所有子内核上并行计算 KeyMap[f,key1val1,key2val2,]. »

范例

打开所有单元关闭所有单元

基本范例  (2)

将函数映射于一个关联的键上:

使用 KeyMap 的运算符形式:

范围  (1)

In KeyMap[f,assoc], if applying f produces repeated keys, later instances replace earlier ones:

属性和关系  (4)

KeyMap[f,assoc] is equivalent to AssociationThread[Map[f,Keys[assoc]]Values[assoc]]:

KeyMap[f,assoc] gives an association with the same length as DeleteDuplicatesBy[Keys[assoc],f]:

KeyMap maps a function over the keys in an association:

Map maps a function over the values in an association:

KeyValueMap maps a function over the keys and values in an association (and returns a list):

AssociationMap maps a function over the rules in an association:

KeyMap can be parallelized automatically:

Wolfram Research (2014),KeyMap,Wolfram 语言函数,https://reference.wolfram.com/language/ref/KeyMap.html.

文本

Wolfram Research (2014),KeyMap,Wolfram 语言函数,https://reference.wolfram.com/language/ref/KeyMap.html.

CMS

Wolfram 语言. 2014. "KeyMap." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/KeyMap.html.

APA

Wolfram 语言. (2014). KeyMap. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/KeyMap.html 年

BibTeX

@misc{reference.wolfram_2024_keymap, author="Wolfram Research", title="{KeyMap}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/KeyMap.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_keymap, organization={Wolfram Research}, title={KeyMap}, year={2014}, url={https://reference.wolfram.com/language/ref/KeyMap.html}, note=[Accessed: 22-November-2024 ]}