On 5 November 2017 at 21:32, Michał Marczyk <michal.marc...@gmail.com> wrote:
> Now, if xs' head has not been realized, (with-meta xs {:foo 1}) can > conceivably operate in one of two ways: > > 1. it can copy over xs' thunk (the nullary function embedded in the lazy > seq object xs that is called – and expected to return a sequence or nil – > when xs needs to be realized) into a new lazy seq object ys; > > 2. it can realize the head of xs and call .withMeta on the result. > > The first approach, however, breaks the promise that realizing the head of > xs will have the effect of realizing the head of ys, as neither xs nor ys > would subsequently have any way of knowing whether the other's head has > been realized when they finally need to realize their own heads, and so the > second one to be realized would be forced to recompute the sequence. > > Thus the implementation takes the second approach. > Why can't it just memoize the thunk when creating a new instance? -- James Reeves booleanknot.com -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.