Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9253101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:07:49+00:00 2026-06-18T11:07:49+00:00

In Java, with a java.util.SortedMap<Long,Object> , we can do something like: sortedMap.headSet(13).clear() to get

  • 0

In Java, with a java.util.SortedMap<Long,Object>, we can do something like:

sortedMap.headSet(13).clear()

to get rid of all the elements with keys < 13. I don’t see anything similar in clojure.core for clojure’s (sorted-map) (which I think is always a clojure.lang.PersistentTreeMap). The best I’ve come up with is something like this:

(let [clear-up-to 13
      sm (sorted-map 1 "aye" 2 "bee" 13 "em" 14 "en")]
      clear-keys (take-while #(< % clear-up-to) (keys sm))
  (apply dissoc sm clear-keys))

Am I missing something simpler?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:07:50+00:00Added an answer on June 18, 2026 at 11:07 am

    Dissoc is the best you can do, but the take-while step should be replaced with subseq or rsubseq, as appropriate.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

java.util.PriorityQueue allows a Comparator to be passed at construction time. When inserting elements, they
keySet() returns java.util.Set. Why doesn't cast to NavigableSet throw a ClassCastException? This can be
java.util.Set specifies only methods that return all records (via Iterator or array). Why is
Using java.util.regex.Pattern.compile() you can specify a pattern as parameter. But how can you specify
In the Scala shell I did this: import java.util._ import scala.collection.JavaConversions._ val t: SortedMap[String,Int]
java.util.BitSet is backed by a long[] so the minimum size is 64 bits. I
java.util.MissingResourceException: Can't find bundle for base name xxx.i18n.base, locale en_US I am currently implementing
Since java.util.Date is mostly deprecated, what's the right way to get a timestamp for
Using java.util.logging.Logger to output some log to the console just like this: public static
The java.util.LinkedList does not allow you to quickly remove a given object in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.