SplitBy

SplitBy[list,f]

list 分割成包含连续元素的顺串,当应用 f 时它给出相同的值.

SplitBy[list,{f1,f2,}]

list 递归分割成子列,对于每个 fi 连续测试元素.

更多信息

  • SplitBy[list,] 分割但并不重新排列 list.
  • SplitBy 仅在相邻元素对上比较.
  • SplitBy[list] 等价于 SplitBy[list,Identity],它也等价于 Split[list].
  • SplitBy[list,{f1,f2}] 等价于 Map[SplitBy[#,f2]&,SplitBy[list,f1]].

范例

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

基本范例  (3)

将数字串分割成有相等整数部分的数对:

将三元组分割成有相同第一个成员的数对:

首先根据它们第一个成员分割,其次按照第二个成员分割:

将日期分割成有相等年的串:

应用  (1)

按照符号分割:

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

文本

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

CMS

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

APA

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2024_splitby, organization={Wolfram Research}, title={SplitBy}, year={2008}, url={https://reference.wolfram.com/language/ref/SplitBy.html}, note=[Accessed: 21-November-2024 ]}