On Thu, Nov 17, 2011 at 09:49:32AM -0500, Raul Miller wrote: > In general, structuring J code is an exercise in picking the right words.
Well, in case you can help with that, here's my situation. For this particular problem, I need to calculate a distance, so I have an origin and a destination. Each of those has a pair of numbers associated with it. In this particular problem, I'm not so much interested in the actual distance as the time it would take a dish to move to the new position, and since it can rotate and rise simultaneously, I can treat the two values separately and then take whichever is larger as the time it would take. In another setting, I would be inclined to say, alright, so I need a way to package up a right ascension and a declination so I can operate on both simulatenously. And I think that would probably work here as well, but: 1. I suspect it would be more idiomatic J to say, I have an array of right ascensions, an array of declinations, let's produce an array of times to move for each axis and then combine both with maximum to produce an array of the actual time to move. 2. In attempting to treat a pair of boxed values as a single value and deal in terms of arrays of those, I think I'm tripping over boxing and rank at the same time. There's probably a reason this topic is reserved for later chapters in JfC. Errors in J are not easy to debug if you're doing too much in one line, and without really understanding what's going on I'm sure I'm bumping into situations where what I really need to do is nest the operation in some kind of unbox/rebox. The only thing that concerns me about going with N arrays of unboxed items versus one array of N boxed items is that my input file looks more like the latter. But it must not be terribly hard to pull each column out into its own variable, if that's the idiomatic thing to do. Anyway, thanks for all your help! My intent is to keep hammering at JfC and LJ and trying different things until I find I am making progress, and coming here whenever I'm surprised. -- Daniel Lyons ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
