You can implement the clojure.lang.IPersistentMap interface if you want to
create your own map type.
суббота, 28 июля 2012 г., 8:09:05 UTC+6 пользователь JvJ написал:
>
> Is there a way to extend whatever protocol is used by Clojure maps (struct
> maps, array maps, hash maps, etc.)?
--
You rec
In Clojure (JVM) Maps, etc. are built on top of Java interfaces and
not Clojure protocols (yet).
And yes, it's quite possible to build your own data-structure that
behaves like a map.
I will be able to give you a better answer if you explain your exact
requirement.
Regards,
BG
On Sat, Jul 28, 2
Is there a way to extend whatever protocol is used by Clojure maps (struct
maps, array maps, hash maps, etc.)?
--
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 memb
>> How about using (extend-type default ...) ? Is it safe to use it?
> Oops, extend-type with default does work and it seems to work well.
This is what I am looking for! Thanks.
2012/1/26 David Nolen :
> On Fri, Jan 13, 2012 at 1:32 PM, Jozef Wagner
> wrote:
>>
>> How about using (extend-type def
On Fri, Jan 13, 2012 at 1:32 PM, Jozef Wagner wrote:
> How about using (extend-type default ...) ? Is it safe to use it?
>
>
Oops, extend-type with default does work and it seems to work well.
David
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To
Now I understand...that makes sense - thanks, D
--
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
On Fri, Jan 13, 2012 at 1:32 PM, Jozef Wagner wrote:
> How about using (extend-type default ...) ? Is it safe to use it?
The question is how to implement that efficiently.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send
How about using (extend-type default ...) ? Is it safe to use it?
--
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 you
It could create interop problems with other JavaScript libraries (including
Google Closure). extending Object modifies its prototype. The problem is
that objects are used as maps in JavaScript and these new properties will
appear if someone tries to iterate through the keys with for..in.
It's unfo
Ok,
I had assumed from this
https://groups.google.com/d/topic/clojure/KQ6AM-nxlTQ/discussion
that I could
Is there anything else not safe to extend?
Cheers
D
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to c
You should never extend js/Object.
On Thursday, January 12, 2012, Dave Sann wrote:
> code is below.
> Basically - if I extend a protocol on js/Object then I get an error when
calling map on a map with integer keys.
> Is this a bug or an error on my part?
> Cheers
> Dave
> Results first:
> If the
code is below.
Basically - if I extend a protocol on js/Object then I get an error when
calling map on a map with integer keys.
Is this a bug or an error on my part?
Cheers
Dave
Results first:
If the extend-protocol and call to 'fred' is commented, ths console shows
"START"
"one"
([2
aria42 a écrit :
Is there a way to say that a protocol extends another protocol or
interface? I.e. can i specify that a given protocol must also support
the "seq" method from clojure.lang.Seqable?
No. There is no hierarchy to protocols. This fits pretty well with the
dynamic nature of Clojure,
Is there a way to say that a protocol extends another protocol or
interface? I.e. can i specify that a given protocol must also support
the "seq" method from clojure.lang.Seqable?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group,
14 matches
Mail list logo