Giter Site home page Giter Site logo

Comments (9)

wlandau avatar wlandau commented on June 4, 2024

I am open to name suggestions. My thoughts so far:

  • tar_interval()
  • tar_periodically()
  • tar_age()
  • tar_schedule()
  • tar_delay()
  • tar_timer()
  • tar_frequently()

from tarchetypes.

noamross avatar noamross commented on June 4, 2024

I like tar_interval(). Another possibility is tar_expire()

from tarchetypes.

petrbouchal avatar petrbouchal commented on June 4, 2024

tar_periodically() and tar_expire() seem intuitively closest to what is in the tin. I think it might be nice to stick to the tar_[noun] pattern for target-generating functions, but nothing appropriate comes to mind.

tar_after(), tar_timeout(), tar_every(), tar_timed() come to mind otherwise.

from tarchetypes.

wlandau avatar wlandau commented on June 4, 2024

Thanks for the suggestions, they definitely help. After thinking it over, I like tar_difftime(). Since I plan to have users pass a difftime object to mark the interval, I find this to be clear and specific.

from tarchetypes.

wlandau avatar wlandau commented on June 4, 2024

And actually, there are at least two conceivable versions of tar_difftime(): one to force a target to rerun when it gets old enough, another to suppress a target until it gets old enough. I think we just want the former.

from tarchetypes.

wlandau avatar wlandau commented on June 4, 2024

Let's first build some custom cues:

  • tar_cue_force(condition): equivalent to tar_cue(mode = ifelse(any(condition), "always", "thorough"))
  • tar_cue_skip(condition): equivalent to tar_cue(mode = ifelse(any(condition), "never", "thorough"))
  • tar_cue_age(name, age): equivalent to tar_cue(mode = ifelse(any(Sys.time() - tar_timestamp_raw(name) > age), "always", "thorough"))

Then build tar_age() for this issue on top of tar_cue_age(). (I think I like that one more than tar_difftime().)

from tarchetypes.

petrbouchal avatar petrbouchal commented on June 4, 2024

Yes, my intuition initially was that I needed a special-purpose cue, so this makes good sense. For simplicity, age could be input as just an integer denoting the number of seconds - though not sure what implications that would have for the internals doing the time comparison.

from tarchetypes.

wlandau avatar wlandau commented on June 4, 2024

tar_age() and those cues I mentioned are now implemented.

For simplicity, age could be input as just an integer denoting the number of seconds - though not sure what implications that would have for the internals doing the time comparison.

I prefer difftime because we don't know what scale of time the user is looking for. If it's seconds and most people turn out to want days, most users will end up supplying a high number for seconds and doing repetitive mental arithmetic.

from tarchetypes.

wlandau avatar wlandau commented on June 4, 2024

Related: turns out tar_age() etc. can work with dynamic branching if we take the max timestamp (so all the branches rerun if the youngest branch's data becomes old enough).

from tarchetypes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.