Hi,
On Sat, Dec 14, 2013 at 3:44 PM, Mariano Martinez Peck < [email protected]> wrote: > > > > On Wed, Dec 11, 2013 at 12:21 PM, Tudor Girba <[email protected]>wrote: > >> Hi, >> >> I put together a little implementation for traversals. It is inspired by >> an original implementation from Mariano. >> > > Wow... my memory is sooo bad I don't remember ;) > I asked once for something that can compute the size of an object, and you sent me a GraphTraverser class. I extended this concept and generalized it a bit. > > >> Using DeepTraverser, you can traverse arbitrary graphs by describing the >> traversal and by specifying the actions you want to perform on the nodes >> and relations. >> >> > Once (or even more times) we thought with Martin 2 things: > > 1) Reify the traversal in Fuel so that we could plug a different one. > 2) Use Fuel only for traversing and allowing user a hook to plug the what > to do with each node. > 3) Use the same traversal of 2) for deepCopying > 4) Use the same traversal of 2) to get an approximate memory consumption > of the transitive closure of an object > This would be great. > But as always happened we run out of time. > > Anyway...I think this is a nice area to explore. There are many uses for a > nice traverser. > Agreed. It would be great to build on DeepTraverser and make it more powerful. Also, did you see we wrote a Rossal extension to print the fuel traversal? > > http://rmod.lille.inria.fr/web/pier/software/Fuel/Version1.9/Documentation/Debugging > Yes. That is cool :) Doru > The code is available in the Moose image as part of the MooseAlgos >> subproject, but can also be loaded separately in a Pharo image via: >> >> Gofer new >> url: 'http://www.smalltalkhub.com/mc/Moose/DeepTraverser/main'; >> package: ‘ConfigurationOfDeepTraverser’; >> load. >> (Smalltalk globals at: #ConfigurationOfDeepTraverser) loadDevelopment. >> >> >> Just to give you an idea, here are some representative examples: >> >> Number >> deep: #subclasses >> do: [:each | Transcript show: each; cr]. >> >> Number deepCollect: #subclasses. >> >> Number >> deep: #subclasses >> collect: #name. >> >> Number >> deep: #subclasses >> do: [:each | Transcript show: each; cr] >> relationDo: [ :from :to | Transcript show: from; show: ' <-- '; show: >> to; cr ]. >> >> >> >> More details about the usages and a little description of the >> implementation can be found here: >> http://www.humane-assessment.com/blog/traversal-enabled-pharo-objects/ >> >> >> Cheers, >> Doru >> >> >> >> -- >> www.tudorgirba.com >> >> "Every thing has its own flow" >> > > > > -- > Mariano > http://marianopeck.wordpress.com > -- www.tudorgirba.com "Every thing has its own flow"
