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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:34:44+00:00 2026-06-13T04:34:44+00:00

It is often a pattern that I wish to poll a file for changes

  • 0

It is often a pattern that I wish to poll a file for changes (when it was last written). When the file does change from its previous value, I wish to execute some function. Something of the form.

(poll-for-changes file-str on-change-fx current-value)

where

  1. file-str is just a string that specifies the files location
  2. on-change-fx is the function that should be called when the file at file-str changes. Let us say that the on-change-fx should take the File object pointing to file-str as a argument.
  3. current-value the current value of the file in milliseconds. You might set to 0 to guarantee that this function will run at least once, or to the actual value to only run this function when you actually detect a change.

I would just like this function implemented in the clearest, most concise, Clojurist way possible. Thank you.

  • 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-13T04:34:45+00:00Added an answer on June 13, 2026 at 4:34 am

    If you’re looking to poll a directory or files and act on it, I think watchtower is pretty good to look at.

    Java 7 has a WatchService, which uses file system events to react to changes. In this case, you don’t poll at all, but block on a future file event. I don’t think there are any projects in Clojure that are out there leveraging that, although I spent some time toying with it to write a small library. The source for it is here

    I don’t claim my library is even complete, but it does use the Java 7 service, so you could use that for inspiration on your own project.

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

Sidebar

Related Questions

In classes that implement INotifyPropertyChanged I often see this pattern : public string FirstName
I often see a pattern used in circumstances where we have look-up code that
I often used the disposable pattern in simple classes that referenced small amount of
I'll often have objects with properties that use the following pattern: private decimal? _blah;
As I implement the MVVM pattern with WPF, I'm finding that ReSharper is often
I see often this pattern (function(){}).call(this) Is that the same with this one? (function(that){})(this)
I've noticed that my dependency injected, observer-pattern-heavy code (using Guava's EventBus ) is often
I use a pattern that looks something like this often. I'm wondering if this
It is a pattern that occurs quite often in one part of our Framework.
I find myself using the current pattern quite often in my code nowadays var

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.