Re: am i the only one with deftype/defprotocol problems?

2010-01-04 Thread Raoul Duke
ah! i think i was screwing up with git :-(

(doc deftype) looks right now.

On Mon, Jan 4, 2010 at 10:36 AM, Raoul Duke  wrote:
> thanks Konrad & Jonas. i figured/hoped it was something stupid simple.
> (for some reason i don't know where to find the latest syntax
> documented.)
>

-- 
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


Re: am i the only one with deftype/defprotocol problems?

2010-01-04 Thread Raoul Duke
thanks Konrad & Jonas. i figured/hoped it was something stupid simple.
(for some reason i don't know where to find the latest syntax
documented.)

-- 
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


Re: am i the only one with deftype/defprotocol problems?

2010-01-04 Thread Jonas Enlund
I think you simply need to get the syntax right. The following works
fine for me:

user=>  (defprotocol p (foo [this]))
p
user=>  (deftype a [f] p (foo []))
#'user/a
user=> (foo (a nil))
nil
user=> (deftype a [f] :as this p (foo [] [this]))
#'user/a
user=> (foo (a nil))
[#:a{:f nil}]




On Mon, Jan 4, 2010 at 6:37 AM, Raoul Duke  wrote:
> hi,
>
> i've only heard crickets so far, am i really the only one who can't
> get this to work? help? :-} thanks. i figure i must be doing something
> dirt simple wrong?
>
> Clojure 1.1.0-new-SNAPSHOT
> user=> (defprotocol p (foo [this]))
> p
> user=> (deftype a [f] [p] (.foo [this]))
> java.lang.RuntimeException: java.lang.ClassCastException:
> clojure.lang.PersistentVector cannot be cast to clojure.lang.Symbol
> (NO_SOURCE_FILE:0)
>
> --
> 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 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


Re: am i the only one with deftype/defprotocol problems?

2010-01-03 Thread Konrad Hinsen
On 4 Jan 2010, at 05:37, Raoul Duke wrote:

> i've only heard crickets so far, am i really the only one who can't
> get this to work? help? :-} thanks. i figure i must be doing something
> dirt simple wrong?
>
> Clojure 1.1.0-new-SNAPSHOT
> user=> (defprotocol p (foo [this]))
> p
> user=> (deftype a [f] [p] (.foo [this]))
> java.lang.RuntimeException: java.lang.ClassCastException:
> clojure.lang.PersistentVector cannot be cast to clojure.lang.Symbol
> (NO_SOURCE_FILE:0)

The syntax rules for deftype have changed a while ago. Try the  
following:

(deftype a [f] :as this p (foo []))

Konrad.

-- 
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


am i the only one with deftype/defprotocol problems?

2010-01-03 Thread Raoul Duke
hi,

i've only heard crickets so far, am i really the only one who can't
get this to work? help? :-} thanks. i figure i must be doing something
dirt simple wrong?

Clojure 1.1.0-new-SNAPSHOT
user=> (defprotocol p (foo [this]))
p
user=> (deftype a [f] [p] (.foo [this]))
java.lang.RuntimeException: java.lang.ClassCastException:
clojure.lang.PersistentVector cannot be cast to clojure.lang.Symbol
(NO_SOURCE_FILE:0)

-- 
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