Raul - I'm working on a project that's on the J wiki right now in which I start with a "naive" piece of code and re-work it to be more J-like. The project is running a bit longer than I intended but I'm rounding the final turn and hope to be wrapping it up soon.
Here's what I have so far: The project starts here with an introduction to diffusion-limited aggregation and an implementation already on the J wiki: http://www.jsoftware.com/jwiki/NYCJUG/2009-10-13#DLA.3AInitialJImplementation It continues here with a superficial re-vamp that aims to preserve how the original code works but make it superficially more J-like: http://www.jsoftware.com/jwiki/DevonMcCormick/DLA00 We look at how this revised version performs by devising some performance metrics: http://www.jsoftware.com/jwiki/DevonMcCormick/DLA0Runs Then we attempt a deeper re-vamp to make the code more J-like here: http://www.jsoftware.com/jwiki/DevonMcCormick/DLA01 This section also makes use of the J profiler. We address a basic flaw in the original implementation here: http://www.jsoftware.com/jwiki/DevonMcCormick/DLA00/BuildingACloseNeighborhood I'm now assembling a final version of the code incorporating the more successful experiments I made along the way. The fits and starts of these experiments are somewhat interesting in their own right but this project has dragged on long enough without including these. To preview one of my results which addresses one of your points: the original implementation works with a single point at a time but it's much more natural in J to work with many points at a time. This also has the benefit of speeding up the code tremendously compared to the original. I'd like to see more evolutionary essays like this as they may provide a good pathway to help people think in J by starting with code that looks familiar, then showing how to move beyond it. Regards, Devon On Wed, Nov 18, 2009 at 5:41 PM, Raul Miller <[email protected]> wrote: > ... > Second, I have seen beginning J programmers with backgrounds from > other languages struggle to express inherently serial algorithms in J. > And yet, in "real life" I have often found that I can push back on > the specifications -- a minor change in the "application" or > "business" logic can often yield easy to implement specifications. > > Of course, sometimes you need to do something serially. And, > sometimes you need C. Sometimes you even need assembly or machine > language. But even when I am producing systems not intended for > implementation in J (which is frequently), I find that approaching > specifications with a "J mindset" can help. > > ... > -- Devon McCormick, CFA ^me^ at acm. org is my preferred e-mail ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
