Skip to content

Commit bd09272

Browse files
committed
a few docs updates
1 parent 057258d commit bd09272

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ A package for dealing with generalized tree-like data structures.
99

1010
## Examples
1111
```julia
12-
julia> t = [[1,2], [3,4]]; # collections in Base are trees
12+
julia> t = [[1,2], [3,4]]; # AbstractArray and AbstractDict are trees
1313

1414
julia> children(t)
1515
2-element Vector{Vector{Int64}}:
1616
[1, 2]
1717
[3, 4]
1818

19-
julia> childindex(t, (2,1))
19+
julia> getdescendant(t, (2,1))
2020
3
2121

2222
julia> collect(PreOrderDFS(t)) # iterate from root to leaves

docs/src/faq.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ several major obstacles
7979
All of this means that you are unlikely to get type-stable code from AbstractTrees.jl without some
8080
effort.
8181

82-
The simplest way around this is to define the `eltype` of tree iterators via
82+
The simplest way around this is to define the `NodeType` trait and `nodetype` (analogous to
83+
`Base.IteratorEltype` and `eltype`):
8384
```julia
84-
Base.NodeType(::Type{<:ExampleNode}) = HasNodeType()
85+
AbstractTrees.NodeType(::Type{<:ExampleNode}) = HasNodeType()
8586
AbstractTrees.nodetype(::Type{<:ExampleNode}) = ExampleNode
8687
```
8788
which is equivalent to asserting that all nodes of a tree are of the same type. Performance

0 commit comments

Comments
 (0)