TreeLeafCount
TreeLeafCount[tree]
给出 tree 的叶子的数量.
范例
打开所有单元关闭所有单元属性和关系 (8)
TreeLeafCount[tree] 等价于 Length[TreeSelect[tree,TreeLeafQ]]:
TreeLeafCount[tree] 等价于 Length[TreeLeaves[tree]]:
TreeLeafCount[tree] 等价于 TreeCount[tree,_,{-1}]:
TreeLeafCount[Tree[{tree1,tree2,…}]] 给出 TreeLeafCount[tree1]+TreeLeafCount[tree2]+…:
TreeLeafCount[Tree[data,None]] 给出 1:
TreeLeafCount[Tree[data,{}]] 给出 0:
可用 TreeFold 计算 TreeLeafCount:
一般来讲,LeafCount[expr] 等价于 TreeLeafCount[ExpressionTree[expr,"Subexpressions",HeadsTrue]]:
一般来讲,LeafCount[expr,HeadsFalse] 等价于 TreeLeafCount[ExpressionTree[expr,"Subexpressions"]]:
文本
Wolfram Research (2022),TreeLeafCount,Wolfram 语言函数,https://reference.wolfram.com/language/ref/TreeLeafCount.html.
CMS
Wolfram 语言. 2022. "TreeLeafCount." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/TreeLeafCount.html.
APA
Wolfram 语言. (2022). TreeLeafCount. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/TreeLeafCount.html 年