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

  • Home
  • SEARCH
  • 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 852775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:39:17+00:00 2026-05-15T07:39:17+00:00

What would be an ideomatic way in Clojure to get a lazy sequence over

  • 0

What would be an ideomatic way in Clojure to get a lazy sequence over a file containing float values serialized from Java? (I’ve toyed with a with-open approach based on line-reading examples but cannot seem to connect the dots to process the stream as floats.)

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-05-15T07:39:18+00:00Added an answer on May 15, 2026 at 7:39 am
    (defn float-seqs [#^java.io.DataInputStream dis]
      (lazy-seq
        (try
          (cons (.readFloat dis) (float-seqs dis))
          (catch java.io.EOFException e
            (.close dis)))))
    
    (with-open [dis (-> file java.io.FileInputStream. java.io.DataInputStream.)]
      (let [s (float-seqs dis)]
        (doseq [f s]
          (println f))))
    

    You are not required to use with-open if you are sure you are going to consume the whole seq.

    If you use with-open, double-check that you’re not leaking the seq (or a derived seq) outside of its scope.

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

Sidebar

Related Questions

What would be an idiomatic way to represent a tree in Clojure? E.g.: A
What would be the best way to implement a bi-directional map in clojure? (By
I would like to get a sum from a column, with and without a
What would be the most idiomatic way to do the following in JavaScript: If
Would it not make sense to support a set of languages (Java, Python, Ruby,
I'm running up against a problem in understanding the CLOS way of handling file
I'm calling functions in the XNA framework from F# that accept Nullable values. Now,
I would like to remove/delete a migration file. How would I go about doing
Would it be possible to print Hello twice using single condition ? if condition
Would it be possible to show an image in full screen mode using silverlight.

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.