[Newbies] What is the best way to generate HTML from an array of arrays

Randal L. Schwartz merlyn at stonehenge.com
Tue Oct 14 00:08:15 UTC 2008


>>>>> "Andy" == Andy Burnett <andy.burnett at knowinnovation.com> writes:

Andy> If there were no embedded arrays I would just do something like:

Andy> model do: [:each| html listItem: (each asString)]

Andy> But as soon as I have embedded arrays, my mind goes a bit blank and I start
Andy> thinking about recursive routines, and that doesn't seem very Smalltalk at
Andy> all!  So, what is the OO way to do this?

Create a visitor pattern.  Teach each of strings and arrays how to
present themselves.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


More information about the Beginners mailing list