Re:Clojure Don’ts: Lazy Effects (2015)
by setzer22 on Saturday March 03, 2018 @12:48PM
(#16510477)
Something that is specially dangerous is mixing laziness and dynamic vars. If you bind a dynamic var to then return a lazy seq, and the dynamic var is used to generate the seq's elements (e.g. `binding` over `map`, and use the bound var inside the map's `fn`), you may get different results depending on when the seq is evaluated (which is not determined)
This made me waste a whole afternoon once. I was even ready to submit a compiler bug!
This made me waste a whole afternoon once. I was even ready to submit a compiler bug!