Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chime-at API changes #50

Closed
AndreaCrotti opened this issue Jun 29, 2021 · 1 comment
Closed

chime-at API changes #50

AndreaCrotti opened this issue Jun 29, 2021 · 1 comment

Comments

@AndreaCrotti
Copy link

Currently the function being called by chime-at just takes the time as argument, and you can just pass one function.

It might be nice if chime-at would allow you to pass the time intervals and either:

  • allow you to pass the function and a list with all the arguments to use at each call
  • allow you to pass just a list of functions, which would solve the above as well I guess if you just do (map #(partial f %) arguments)

This would allow to generate the input for chime-at more functionally.

(def args [["first"] ["second"]])
(defn f [args] ...) 
(chime-at intervals f args)

or just

(def args [["first"] ["second"]])
(defn f [args] ...) 
(def fns (map #(partial f %) args))
(chime-at intervals fns)
@jarohen
Copy link
Owner

jarohen commented Jun 29, 2021

Cheers @AndreaCrotti 🙏 As discussed, this probably isn't one I'd include in Chime for the time being, unless there's a groundswell of people shouting for it 😄

In the meantime, I've seen Iterator used for things like this in the past - passing (.iterator coll) to f, then calling (.next it) in f - HTH!

James

@jarohen jarohen closed this as completed Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants