Skip to content

Instantly share code, notes, and snippets.

@raspasov
Last active March 20, 2023 22:21
Show Gist options
  • Select an option

  • Save raspasov/c25c9b635fa9ef7c8743cb115dae45dd to your computer and use it in GitHub Desktop.

Select an option

Save raspasov/c25c9b635fa9ef7c8743cb115dae45dd to your computer and use it in GitHub Desktop.
Transducers interrupt
(transduce
(map-indexed (fn [idx item] [idx item]))
(fn
;;completing arity
([accum] accum)
;;reduce arit
([accum [idx item]]
(if (< 100 idx) ;; stop at 100
(reduced accum) ;; stop
(conj accum item)))) ;; else, continue
[]
(range))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment