我在Julia语言文档中看到了这个例子.它使用了一些东西Base.这是什么Base?
immutable Squares
count::Int
end
Base.start(::Squares) = 1
Base.next(S::Squares, state) = (state*state, state+1)
Base.done(S::Squares, s) = s > S.count;
Base.eltype(::Type{Squares}) = Int # Note that this is defined for the type
Base.length(S::Squares) = S.count;
Run Code Online (Sandbox Code Playgroud) julia ×1