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 8347617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:24:47+00:00 2026-06-09T07:24:47+00:00

Other than loop .. recur, what is the best Clojure construct to use so

  • 0

Other than loop .. recur, what is the best Clojure construct to use so that while traversing a sequence of sequences (sos), the processing can stop if a result is found?

Here are the details:

I have a lazy sequence returned from clojure-csv, an sos.

There is a value at a given position (index) in each sequence within the sos.

I keep looking at that position in each sequence until the value is found or
the end of sos is reached.

If the value is found, I want to stop processing the sos.

The only thing I can think of is using a for with when and an into to retain the match, but the sequence processing won’t stop, or use filter.

However, I believe I can use something better, but I’m stuck as to what that would be.

Thanks.

  • 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-09T07:24:49+00:00Added an answer on June 9, 2026 at 7:24 am

    How about this?

    (defn find-first [pred col]
      (first (filter pred col)))
    

    Then you can do this as an example:

    (find-first #(< % 5) coll)
    

    You should be able to make a predicate that works with a sequence of sequences.

    user=> (defn find-first [pred col]
      (first (filter pred col)))
    #'user/find-first
    user=> (find-first #(> % 10) '(1 5 8 2 15 20 31 5 1))
    15
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are languages other than Lisp (ruby, scala) that say they use REPL (Read,
Other than that I don't know if I can reproduce it now that it's
Other than the fact that PNG is a more common image format, is there
Other than Active Sync not working, are there any other limitations that I need
What is the alternate logic to Iterate other than for loop in sending newsletter
Is there a way - other than a for loop - to generate new
I mean other than using it when required for functions, classes, if, while, switch,
Other than using the Column chart and naming appropriately is it possible to create
Other than as a modulus operator, what does the percent sign do in PHP?
Other than using browser,How can I get the public key of a websites which

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.