FoldList
例題
すべて開く すべて閉じる例 (6)
FoldList[f, x, {a, b, c, d}]FoldList[Plus, 0, {a, b, c, d}]FoldList[#1 ^ #2&, x, {a, b, c, d}]FoldList[f, {a, b, c, d}]1つの引数にFoldListの演算子形を使う:
FoldList[f][{a, b, c, d}]2つの引数にFoldListの演算子形を使う:
FoldList[f][x, {a, b, c, d}]スコープ (2)
一般化と拡張 (2)
頭部はListでなくともよい:
FoldList[f, x, p[a, b, c, d]]FoldList[g[#2, #1]&, x, {a, b, c, d}]アプリケーション (15)
FoldList[Times, 1, Range[10]]FoldList[Times, 1, Array[Prime, 10]]FoldList[Plus, 0, {a, b, c, d}]FoldList[1 / (#2 + #1)&, x, Reverse[{a, b, c}]]FoldList[x #1 + #2&, 0, {a, b, c, d}]FoldList[10#1 + #2&, 0, {4, 5, 1, 6, 7, 8}]FoldList[#2 - #1&, 0, {a, b, c, d, e}]FoldList[Plus, 0, Table[(-1) ^ RandomInteger[], {20}]]FoldList[Max, 0, {1, 3, 1, 2, 4, 1, 5, 3, 6, 2, 8, 11}]DeleteDuplicates[%]FoldList[#1[[#2]]&, (a + b)(x ^ 2 + y ^ 2), {2, 1, 1}]FoldList[Part, (a + b)(x ^ 2 + y ^ 2), {2, 1, 1}]FoldList[Append, {x}, {a, b, c, d}]FoldList[List, x, {a, b, c, d}]FoldList[{#2, #1}&, x, {a, b, c, d}]FoldList[#2[#1]&, x, {a, b, c, d}]With[{m = x, t = 85}, FoldList[#1 ^ 2 m ^ #2&, 1, IntegerDigits[t, 2]]]With[{m = 3, t = 85}, FoldList[#1 ^ 2 m ^ #2&, 1, IntegerDigits[t, 2]]]特性と関係 (5)
FoldListは長さ
のリストを作る:
Length[FoldList[f, x, Range[10]]]Restは長さ
の結果を与える:
Rest[FoldList[Plus, 0, {a, b, c, d, e}]]FoldList[f, x, {}]FoldList[f, x, {a, b, c}]Fold[f, x, {a, b, c}]第2引数を無視する関数はNestListと同じ結果を返す:
FoldList[f[#1]&, x, Range[5]]NestList[f, x, 5]AccumulateはPlusを伴うFoldListに等しい:
FoldList[Plus, {a, b, c, d}]Accumulate[{a, b, c, d}]考えられる問題 (1)
テクニカルノート
関連するガイド
-
▪
- 関数のリストへの適用 ▪
- 関数反復 ▪
- 関数型プログラミング ▪
- 増分 ▪
- 言語の概要 ▪
- リスト操作
履歴
1991 で導入 (2.0) | 2012 で更新 (9.0) ▪ 2016 (11.0)
テキスト
Wolfram Research (1991), FoldList, Wolfram言語関数, https://reference.wolfram.com/language/ref/FoldList.html (2016年に更新).
CMS
Wolfram Language. 1991. "FoldList." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/FoldList.html.
APA
Wolfram Language. (1991). FoldList. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FoldList.html
BibTeX
@misc{reference.wolfram_2026_foldlist, author="Wolfram Research", title="{FoldList}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/FoldList.html}", note=[Accessed: 30-October-2026]}
BibLaTeX
@online{reference.wolfram_2026_foldlist, organization={Wolfram Research}, title={FoldList}, year={2016}, url={https://reference.wolfram.com/language/ref/FoldList.html}, note=[Accessed: 30-October-2026]}