Skip to content

Instantly share code, notes, and snippets.

@timmc
Last active December 16, 2015 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timmc/5415140 to your computer and use it in GitHub Desktop.
Save timmc/5415140 to your computer and use it in GitHub Desktop.
(defn delayed
[p init]
(let [prev (atom init)]
(fn delayed-pred [& args]
(let [now (apply p args)
ret @prev]
(reset! prev now)
ret))))
(take-while (delayed #(< % 200) true) [64 70 200 90])
;; No, don't use this. It's silly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment