Skip to content

Instantly share code, notes, and snippets.

@daveray
Last active January 4, 2016 10:59
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 daveray/8611948 to your computer and use it in GitHub Desktop.
Save daveray/8611948 to your computer and use it in GitHub Desktop.
transient + core.async
; Is there a way to tell assoc! "No really, I know what I'm doing."
; Do I know what I'm doing?
(->> (async/to-chan [[:a 1] [:b 2] [:c 3]])
(async/reduce (fn [acc [k v]]
(assoc! acc k v))
(transient {}))
(async/map< persistent!)
(async/<!!))
;=>
; Exception in thread "async-dispatch-52" java.lang.IllegalAccessError: Transient used by non-owner thread
; at clojure.lang.PersistentArrayMap$TransientArrayMap.ensureEditable(PersistentArrayMap.java:449
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment