On 03.03.2010, at 16:05, Andrea Tortorella wrote:
> given that a protocol is represented as a simple map, which is the
> way to know if something is infact a protocol.
I don't think that is possible without relying on undocumented characteristics
that are likely to change. What do you need this
I'm not on my machine so i'cant experiment, i tried on #clojure with
clojurebot but it's not 1.2, so i ask here,
given that a protocol is represented as a simple map, which is the
way to know if something is infact a protocol.
Or suppose i want to add a function that works on protocols how can i
Hi,
On Mar 3, 2:43 pm, Andrea Tortorella wrote:
You have to use some instance of T.
> (extends? P T)
> ;==> nil
(extends? P some-t) will return false, because you don't call extend
explicitly.
> (satisfies? P T)
> ;==> nil
(satisfies? P some-t) will return true.
> (extenders P)
> ;==>nil
S
Hi Andrea,
You need to make two little changes: (1) satisfies? is a predicate
about instances, not types, and (2) the extend predicates check for
explicit extension:
(defprotocol P
(foo [x]))
(deftype T [])
(extend ::T
P
{:foo (fn [] "dummy")})
(extends? P T)
=> true
(satisfies? P (
On 03.03.2010, at 14:43, Andrea Tortorella wrote:
> (extends? P T)
> ;==> nil
> (satisfies? P T)
> ;==> nil
> (extenders P)
> ;==>nil
The doc string of both extends? and extenders refers to types "explicitly
extending" a protocol. My understanding is that this excludes protocols
implemented via
On Wed, Mar 3, 2010 at 8:43 AM, Andrea Tortorella wrote:
> Hi everyone,
>
> if I run this code:
>
> (defprotocol P
> (foo [x]))
>
> (deftype T []
> P
> (foo [] "dummy"))
>
> (extends? P T)
> ;==> nil
> (satisfies? P T)
> ;==> nil
> (extenders P)
> ;==>nil
>
> are they not yet implemented?
>
Ni
Hi everyone,
if I run this code:
(defprotocol P
(foo [x]))
(deftype T []
P
(foo [] "dummy"))
(extends? P T)
;==> nil
(satisfies? P T)
;==> nil
(extenders P)
;==>nil
are they not yet implemented?
anyway when I run
(type P)
;==> clojure.lang.PersistentArrayMap
So the protocol is simply
I see; then that of course would be the reason. Thanks for the answer.
On Nov 23, 12:24 pm, Rich Hickey wrote:
> On Nov 23, 11:36 am, samppi wrote:
>
>
>
>
>
> > Variable-length arguments in protocols seem to be supported, but
> > there's just a weird, stateful behavior. Look what happens when y
On Nov 23, 11:36 am, samppi wrote:
> Variable-length arguments in protocols seem to be supported, but
> there's just a weird, stateful behavior. Look what happens when you
> call foo first with one argument twice (it fails both times), then two
> arguments (it succeeds), then one argument again
Variable-length arguments in protocols seem to be supported, but
there's just a weird, stateful behavior. Look what happens when you
call foo first with one argument twice (it fails both times), then two
arguments (it succeeds), then one argument again (it succeeds now
too!). Is this a Clojure bug?
On Nov 23, 7:36 am, samppi wrote:
> The following code contains an error, and I cannot figure out what it
> is at all. When I run StateMeta's test once, the statement marked with
> a comment above fails. When I run it again, it succeeds. This has been
> causing very weird bugs in my code. I've r
The following code contains an error, and I cannot figure out what it
is at all. When I run StateMeta's test once, the statement marked with
a comment above fails. When I run it again, it succeeds. This has been
causing very weird bugs in my code. I've replicated the behavior in
both a script and t
12 matches
Mail list logo