Sorted dict 1

Pull request for SortedDict and BalancedTree23 taking into account Kevin Squire's feedback from the past 12 days.

(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




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]
> 
> 
>