Last active
March 20, 2023 22:21
-
-
Save raspasov/c25c9b635fa9ef7c8743cb115dae45dd to your computer and use it in GitHub Desktop.
Transducers interrupt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(transduce | |
(comp | |
(map-indexed (fn [idx item] [idx item])) | |
(map (fn [[idx item]] | |
(println "sending to space" idx) | |
[idx item]))) | |
(fn | |
;;completing arity | |
([accum] accum) | |
;;reduce arity | |
([accum [idx item]] | |
(if (< 100 idx) | |
(reduced accum) | |
accum))) | |
[] | |
(range)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment