Clarify the sense in which Nim supports recursive iterators in the (#15834)
manual, the tutorial, and the `tbintree` test.
This commit is contained in:
parent
7d640e0943
commit
f17555770e
3 changed files with 44 additions and 7 deletions
|
|
@ -55,8 +55,8 @@ proc find*[Ty2](b: PBinaryTree[Ty2], data: Ty2): bool =
|
|||
|
||||
iterator preorder*[T](root: PBinaryTree[T]): T =
|
||||
# Preorder traversal of a binary tree.
|
||||
# Since recursive iterators are not yet implemented,
|
||||
# this uses an explicit stack:
|
||||
# This uses an explicit stack (which is more efficient than
|
||||
# a recursive iterator factory).
|
||||
var stack: seq[PBinaryTree[T]] = @[root]
|
||||
while stack.len > 0:
|
||||
var n = stack.pop()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue