There was a google talk on Visitor pattern in Java and Common Lisp that you might find interesting<br><br><a href="http://www.youtube.com/watch?v=VeAdryYZ7ak">http://www.youtube.com/watch?v=VeAdryYZ7ak</a><br><br>Daryoush<br>
<br><div class="gmail_quote">On Wed, Jun 3, 2009 at 6:10 AM, Tom.Amundsen <span dir="ltr">&lt;<a href="mailto:tomamundsen@gmail.com">tomamundsen@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
So, last night, I was having this problem with my Java code where I couldn&#39;t<br>
figure out for the life of me how to write a piece of code without a big if<br>
{} else if {} else if {} ... else {} structure. I was Googling &quot;Java<br>
Reflection&quot; to try to determine how to &quot;cast to the most concerete subclass<br>
at runtime.&quot; Then it dawned on me that what I was trying to do has already<br>
been solved by using the Visitor design pattern.<br>
<br>
Then, after reading the Visitor design pattern page on Wiki, it said that<br>
the visitor pattern is essentially an implementation of a functor. Aha! It<br>
totally clicked. The Visitor pattern allows you to collect code for similar<br>
operations, while spreading apart code for similar objects. Now that really<br>
sounds like a functor!<br>
<br>
Although, now I&#39;m second guessing myself, because I can&#39;t figure out how we<br>
could create some design pattern that simulates an applicative functor. I&#39;m<br>
pretty sure the Visitor pattern doesn&#39;t take you this far (but I am willing<br>
to be corrected). So, is there a way to create applicative functors in<br>
non-functional languages? What would that pattern look like?<br>
<br>
- Tom<br>
<font color="#888888">--<br>
View this message in context: <a href="http://www.nabble.com/Functors-and-the-Visitor-Pattern-tp23851113p23851113.html" target="_blank">http://www.nabble.com/Functors-and-the-Visitor-Pattern-tp23851113p23851113.html</a><br>

Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</font></blockquote></div><br><br clear="all"><br>