On 5 November 2017 at 21:32, Michał Marczyk
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
About realizing the head of lazy seqs in with-meta:
On 5 November 2017 at 01:57, Didier wrote:
> > That said, metadata and its relationship to an object is immutable - an
>>> object with different metadata is a different object. One consequence of
>>> this is that applying
On 5 November 2017 at 00:57, Didier wrote:
> I think I'm firstly confused by the use of the word object. I'm guessing
> in this case it refers to things that implement IObj?
>
It means an object on the JVM.
> I'm then confused by what is meant that an object with different
first class values on the jvm are objects
On Sat, Nov 4, 2017 at 5:57 PM Didier wrote:
> > That said, metadata and its relationship to an object is immutable - an
>>> object with different metadata is a different object. One consequence of
>>> this is that applying metadata
>
> > That said, metadata and its relationship to an object is immutable - an
>> object with different metadata is a different object. One consequence of
>> this is that applying metadata to a lazy sequence will realize the head of
>> the sequence so that both objects can share the same
On 3 November 2017 at 06:57, Didier wrote:
> Okay, I can see how I can maybe infer some of that by piecing together the
> code base, but if there was a book, or a reference somewhere describing
> more the implementation of Clojure itself I'd be interested to read it, if
>
Okay, I can see how I can maybe infer some of that by piecing together the code
base, but if there was a book, or a reference somewhere describing more the
implementation of Clojure itself I'd be interested to read it, if there is one
out there. I'd understand if there's not, I know Clojure has
On 3 November 2017 at 02:31, Didier wrote:
> Wow, thanks. Is that all tribal knowledge? Or is there some documentation
> around the Clojure interfaces and their semantics somewhere I could read?
> Maybe even a Clojure book recommendation that covers this?
>
Each of the
Wow, thanks. Is that all tribal knowledge? Or is there some documentation
around the Clojure interfaces and their semantics somewhere I could read? Maybe
even a Clojure book recommendation that covers this?
So if I understand correctly, withMeta will return a new object which is not
equal to
+1 to everything James said.
--
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
IMeta only allows you to read metadata.
IObj is for immutable data that can be duplicated with new metadata.
IReference is for references.
So an immutable map would implement IObj, but an atom would implement
IReference.
If you want to support metadata, you need to decide what type of object it
To start with, IObj and its .meta method are used with clojure.core/meta to
get the metadata on an object. Since this method can be the same between
refs and immutable data, they all use the same interface.
IMeta is used with withMeta and clojure.core/with-meta to return a new
object with the
Hey, I was surprised to find that IMeta does not work for (with-meta).
So it seems that withMeta is added to IObj, which extends IMeta. And it
seems like alterMeta and resetMeta are added in IReference, which also
extends IMeta.
So now if you want to support meta, you have to implement
13 matches
Mail list logo