Riffle
更多信息
- 如果在 Riffle[{e1,e2,…},{x1,x2,…}] 中 xi 少于 ei 之间的间隙,则周期性使用 xi.
- Riffle[{e},x] 给出 {e}.
- {imin,imax,n} 指定具有 Take 中使用的类型. 负指数从列表末端开始计算.
- Riffle[list,x] 等同于 Riffle[list,x,{2,-2,2}].
- Riffle[list,x,n] 等同于 Riffle[list,x,{n,-2,n}].
- 在 Riffle[list,xlist] 中, 如果 list 和 xlist 同样长,然后它们的元素是直接交叉存取,以致于最终结果是 xlist 中最后的元素.
- Riffle 对 SparseArray 对象适用.
范例
打开所有单元 关闭所有单元基本范例 (3)
范围 (7)
Riffle[{1, 2, 3, 4, 5, 6, 7, 8, 9}, x]Riffle[{1, 2, 3, 4, 5, 6, 7, 8, 9}, x, {2, -2, 2}]Riffle[{1, 2, 3, 4, 5, 6, 7, 8, 9}, x, {1, -1, 2}]Riffle[{1, 2, 3, 4, 5, 6, 7, 8, 9}, x, {1, -1, 3}]Riffle[{1, 2, 3, 4, 5, 6, 7, 8, 9}, x, {5, -1, 2}]Riffle[{1, 2, 3, 4, 5, 6, 7, 8, 9}, {x, y}, {5, -1, 2}]Riffle[{a, b, c, d}, {x, y, z, w}]Riffle 应用在 SparseArray 对象:
Riffle[SparseArray[5 -> 1, 10], x]应用 (5)
StringJoin[Riffle[{"this", "is", "an", "example"}, " "]]StringJoin[Riffle[{"usr", "local", "bin"}, "/"]]Riffle[Range[10], 0]Riffle[Range[10], -Range[10]]StringJoin[Riffle[Characters["4345252523535"], ",", {-4, 1, -4}]]技术笔记
-
▪
- 重排列表 ▪
- 列表的分组和填充 ▪
- 列表元素的分组和合并
文本
Wolfram Research (2007),Riffle,Wolfram 语言函数,https://reference.wolfram.com/language/ref/Riffle.html.
CMS
Wolfram 语言. 2007. "Riffle." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/Riffle.html.
APA
Wolfram 语言. (2007). Riffle. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/Riffle.html 年
BibTeX
@misc{reference.wolfram_2026_riffle, author="Wolfram Research", title="{Riffle}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/Riffle.html}", note=[Accessed: 28-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_riffle, organization={Wolfram Research}, title={Riffle}, year={2007}, url={https://reference.wolfram.com/language/ref/Riffle.html}, note=[Accessed: 28-November-2026]}