Hi,

Here is an example of the implementation of the "Visitor" design
pattern in clojure.
Multimethods are sufficiently powerfull and there is nothing explictly
named "xxVisitor" in the code example, since with clojure the Visitor
pattern is a non-issue and solved by the more general multimethod
concept.

Find the code in the files section of clojure google group :
http://clojure.googlegroups.com/web/state.clj

And find here an example of using the code :

1:6 designpatterns.state=> (-> (create-photo-booth 3) insert-coin
button-identity-photo insert-coin button-release-coin)
Insert coin
Select your photo
Take your identity photo
Select your photo
liberer piece
{:photos 2, :state :needs-coin}
1:7 designpatterns.state=>

It's more a tutorial-like example than a "real life" example, but I
hope it will help,

Regards,

-- 
Laurent

2009/6/2 Glen Stampoultzis <[email protected]>:
> I'm used to polymorphism in OO systems where everything in driven from
> inheritance hierarchy.  Clojures defmulti style polymorphism seems powerful
> but has left me wondering how to most effectively use it.  I'm looking for
> some good real world examples of how people have used polymorphism in
> clojure.
> Regards,
> Glen Stampoultzis
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to