Sorted dict 1

Pull request for SortedDict and BalancedTree23 taking into account Kevin Squire's feedback from the past 12 days.
Hi Steve, just so you know, I (and most members of the JuliaLang
Organization) get an email for most comments made in the DataStructures
repository, so I got both versions.  As you know, the messages are usually
available as part of the pull request, but sometimes they get lost or
hidden by later pushes to the repository, especially if those pushes were
forced.  (And sometimes there are just bugs.)

The meta-statements you referred to are for the status images at the top of
the DataStructures.jl page <https://github.com/JuliaLang/DataStructures.jl>.
The easiest thing to do is to copy them exactly as-is into the new
Readme.rst file--they should just work as is.

Documentation for each is available through the respective service--e.g.,
automated build testing is provided by travis-ci.com, and the indicator
badge documentation is here <http://docs.travis-ci.com/user/status-images/>.
The other two are for other services that have been enabled on the
DataStructures.jl repository--coveralls.io provides coverage information
from a travis test run, and PkgEval is a Julia-specific service which runs
the tests in the test directory against the latest release and the latest
development builds of Julia.


On Mon, Oct 27, 2014 at 9:06 PM, StephenVavasis <notifications@github.com>
wrote:

> In src/sortedDict.jl:
>
> > +IncludeLast{K, D, Ord <: Ordering}(m1::SortedDict{K, D, Ord}, first1::Int, last1::Int) =
> > +            IncludeLast{K,D,Ord}(m1, first1, last1)
> > +
> > +typealias SDIterableTypes Union(SortedDict,ExcludeLast,IncludeLast)
> > +
> > +done(::SDIterableTypes, state::SDIterationState) = state.next == state.final
> > +
> > +function next(::SDIterableTypes, state::SDIterationState)
> > +    m = state.m
> > +    sn = state.next
> > +    if sn < 3 || !in(sn, m.bt.useddatacells)
> > +        throw(BoundsError())
> > +    end
> > +    return (m.bt.data[sn].k, m.bt.data[sn].d, SDToken(sn, m)),
> > +           SDIterationState(m, nextloc0(m.bt, sn), state.final)
> > +end
>
> (Note: I am reposting this message; something strange happened with my
> previous attempt to post it, perhaps because there is some meta-code below
> that may have been intercepted and interpreted by github. In this repost I
> have tried to disguise the meta-code by putting additional spaces in it.
> --SV) Kevin, I'm working on SortedDict again; I just figured out how to
> merge the new code I wrote with all the changes that have been made to
> DataStructures.jl over the past month. One change I have made is to replace
> README.md by README.rst because the md markup language seems to be too
> limited for proper documentation. In particular, it does not seem to have
> formatting instructions to properly typeset a list of functions with a
> paragraph of documentation per function like the manual's documentation of
> the standard library functions. However, README.md in the current master
> appears to have some meta-statements related to code status: [ ! [ B u i l
> d S t a t u s ] ( h t t p s: / /t r a v i s - c i . o r g
> /JuliaLang/DataStructures.jl.svg? branch=master)](https://travis-ci.org
> /JuliaLang/DataStructures.jl) [ ! [ C o v e r a g e Status](h t t p s ://i
> m g . s h i e l d s . i o/ coveralls/JuliaLang/DataStructures.jl.svg)](h t
> t p s : / / c o v e r a l l s . i o /r/J uliaLang/DataStructures.jl) [ ! [
> D a t a S t r u c t u r e s ] ( h t t p : / / p k g . j u l i a l a n g . o
> r g /badges/DataStructures_release.svg)] ( h t t p : / / p k g . j u l i a
> l a n g.org/?pkg=DataStructures&ver=release) I don't know what any of
> this means, and I also don't know whether it can be expressed in an .rst
> file. Is this documented somewhere? Thanks, Steve
> … <#14954ef071a929be_>
> On Wed, 15 Oct 2014, Kevin Squire wrote: In src/sortedDict.jl: >
> +IncludeLast{K, D, Ord <: Ordering}(m1::SortedDict{K, D, Ord}, first1::Int,
> last1::Int) = > + IncludeLast{K,D,Ord}(m1, first1, last1) > + > +typealias
> SDIterableTypes Union(SortedDict,ExcludeLast,IncludeLast) > + >
> +done(::SDIterableTypes, state::SDIterationState) = state.next ==
> state.final > + > +function next(::SDIterableTypes,
> state::SDIterationState) > + m = state.m > + sn = state.next > + if sn < 3
> || !in(sn, m.bt.useddatacells) > + throw(BoundsError()) > + end > + return
> (m.bt.data[sn].k, m.bt.data[sn].d, SDToken(sn, m)), > + SDIterationState(m,
> nextloc0(m.bt, sn), state.final) > +end Is this correct? If so, should I
> include similar code in SortedDict when an item is deleted from the
> structure? Yes, that is correct. Tough call. I'm a little leary, but I
> don't think these will disappear from Base any time soon, and they are
> being used for the same reason. How about using them, but adding a test to
> see if the call succeeds (just create an array and call the function on
> it). If the test ever fails, we'll know that those calls would need to
> change. — Reply to this email directly or view it
> onGitHub.[7881863__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcyODk3OTkxMywiZGF0YSI6eyJpZCI6N
> DE3MzQ5Mjl9fQ==--6360f46fb4cc5e17165a7993be3370cab789e43c.gif]
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/JuliaLang/DataStructures.jl/pull/53/files#r19452554>.
>