type TraverserCore
 Start::PhyNode
 Behind::Stack
 History::Array{PhyNode, 1}
 Current::PhyNode
end
type DepthFirstTraverser <: TreeTraverser
 Ahead::Stack
 Core::TraverserCore
 function DepthFirstTraverser(tree::Phylogeny)
  x = new(Stack(PhyNode), TraverserCore(tree.Root, Stack(PhyNode), PhyNode[], tree.Root))
  for i in x.Core.Current.Children
   push!(x.Ahead, i)
  end
  return x
 end
end
It has methods like:
function next!(x::DepthFirstTraverser)
 push!(x.Core.Behind, x.Core.Current)
 x.Core.Current = pop!(x.Ahead)
 for i in x.Core.Current.Children
  push!(x.Ahead, i)
 end
end
function getCurrent(x::TreeTraverser)
 return x.Core.Current
end
function hasReachedEnd(x::TreeTraverser)
 length(x.Ahead) > 0 ? false : true
endwhile true  show(getCurrent(traverser))  if hasReachedEnd(traverser)   break  end  next!(traverser)endfor i = DepthFirstTraverser(myTree)
# BLARGH
endimmutable DepthFirst  tree::Phylogenyend
function start(x::DepthFirst)Â state = Stack(PhyNode)Â push!(state, x.tree.Root)Â return stateend
function next(x::DepthFirst, state) current::PhyNode = pop!(state) for i in current.Children  push!(state, i) end return current, stateend
function done(x::DepthFirst, state)Â return length(state) == 0 ? true : falseend
Then:
for i in DepthFirst(myTree)
i
end
results in:
ERROR: `start` has no method matching start(::DepthFirst)
 in anonymous at no file
Yes; Base is implicitly imported, meaning that you can use any function in Base without having to explicitly import it. However, in order to extend the function with new methods, you do need to import it explicitly (using a statement like import Base.start, Base.next, Base.done or import Base: start, next, done). Otherwise, you’ll shadow the function in Base instead.
// T