我试图在Julia中实现一个迭代器,但是当for循环尝试调用时会得到异常start.
这是我得到的(我运行include(...),然后using RDF):
julia> methods(start)
# 1 method for generic function "start":
start(graph::Graph) at /Users/jbaran/src/RDF.jl/src/RDF.jl:214
julia> for x in g
println(x)
end
ERROR: `start` has no method matching start(::Graph)
in anonymous at no file
Run Code Online (Sandbox Code Playgroud)
RDF模块中的函数定义目前如下所示:
function start(graph::Graph)
return GraphIterator(collect(keys(graph.statements)), nothing, nothing, nothing, [], [])
end
Run Code Online (Sandbox Code Playgroud)
知道我做错了什么吗?
julia ×1