Skip to content

Instantly share code, notes, and snippets.

@kaffein
Created December 5, 2018 09:25
Show Gist options
  • Save kaffein/160c895594c1bac07eafe8c42d4ec8a9 to your computer and use it in GitHub Desktop.
Save kaffein/160c895594c1bac07eafe8c42d4ec8a9 to your computer and use it in GitHub Desktop.
(async/<!!
(async/go-loop [n 0 acc {}]
(if (< n 10)
;; keep aggregating values
(recur (inc n) (assoc acc n (* n n)))
;; done aggregating, return the accumulated values
acc)))
@kaffein
Copy link
Author

kaffein commented Dec 5, 2018

gives : {0 0, 7 49, 1 1, 4 16, 6 36, 3 9, 2 4, 9 81, 5 25, 8 64}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment