You can include multiple definitions of the same method, with
different arguments, in a deftype.

(deftype Foo [f]
  (bar [x] ...)
  (bar [x y] ...))

Don't know if that's intended, but it works.
-SS

On Jan 19, 3:50 pm, Konrad Hinsen <konrad.hin...@fastmail.net> wrote:
> Protocols permit the declaration of functions with multiple argument  
> lists:
>
> (defprotocol FooP
>    (bar [x] [x y] ""))
>
> It is straightforward to implement those using extend or extend-type:
>
> (deftype Foo
>    [f] :as this)
>
> (extend-type ::Foo
>    FooP
>      (bar ([x] (:f x))
>          ([x y] [(:f x) y])))
>
> However, I haven't found a way to implement them directly in the  
> deftype form. Is this possible? If so, how?
>
> 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

Reply via email to