On Thu, Sep 1, 2011 at 11:13 AM, Sunil S Nandihalli <
sunil.nandiha...@gmail.com> wrote:

> Hi Everybody,
>  I would like to create a sorted-data-structure which would enable me to
> efficiently
>
> 1. insert new elements into it maintaining the sorted-nature of the data
> structure.
> 2. query as to which element is immediately before and after a value that I
> present. one can assume that the value that I present is guaranteed to be
> present in the data-structure.
>
> How can I do it? what should I be using to achieve this? I tried to see if
> finger-trees could help with my limited understanding with no success. This
> might be pretty basic .. but some how I seem to be missing something.
>
>
Is this what you want?

user=> (def s (sorted-set 38 42 123 598 23 10 1 88))

user=> (first (subseq s > 50))
88

(first (rsubseq s < 50))
42

-- 
Dave

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to