Harvey, I will have to admit, I stumbled on the effect of { (catalogue) on rank 2 arrays by accident. I was looking for ways to box the rows in a 2-d matrix, and just tried { to see what happens since I knew it would box a single vector.
{1 2 3 4 5 6 ┌───────────┐ │1 2 3 4 5 6│ └───────────┘ Then I tried a rank 2 array: 3,\1 2 3 4 5 6 1 2 3 2 3 4 3 4 5 4 5 6 {3,\1 2 3 4 5 6 ┌─────┬─────┬─────┬─────┐ │1 2 3│2 3 4│3 4 5│4 5 6│ └─────┴─────┴─────┴─────┘ Then a rank 3 array: i.3 3 3 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 {i.3 3 3 ┌────────┬────────┬────────┐ │0 1 2 │3 4 5 │6 7 8 │ ├────────┼────────┼────────┤ │9 10 11 │12 13 14│15 16 17│ ├────────┼────────┼────────┤ │18 19 20│21 22 23│24 25 26│ └────────┴────────┴────────┘ I use this quite a lot. The Vocabulary probably needs to at least show an example of this kind of use of catalogue, as it often comes in quite handy. The key issue is that the arrays must be unboxed to start with. If not, you get a very different result: 1 2 3;4 5 6;7 8 9 ┌─────┬─────┬─────┐ │1 2 3│4 5 6│7 8 9│ └─────┴─────┴─────┘ {1 2 3;4 5 6;7 8 9 ┌─────┬─────┬─────┐ │1 4 7│1 4 8│1 4 9│ ├─────┼─────┼─────┤ │1 5 7│1 5 8│1 5 9│ ├─────┼─────┼─────┤ │1 6 7│1 6 8│1 6 9│ └─────┴─────┴─────┘ ┌─────┬─────┬─────┐ │2 4 7│2 4 8│2 4 9│ ├─────┼─────┼─────┤ │2 5 7│2 5 8│2 5 9│ ├─────┼─────┼─────┤ │2 6 7│2 6 8│2 6 9│ └─────┴─────┴─────┘ ┌─────┬─────┬─────┐ │3 4 7│3 4 8│3 4 9│ ├─────┼─────┼─────┤ │3 5 7│3 5 8│3 5 9│ ├─────┼─────┼─────┤ │3 6 7│3 6 8│3 6 9│ └─────┴─────┴─────┘ Skip Cave Consulting LLC On Mon, May 18, 2020 at 3:38 AM HH PackRat <hhpack...@gmail.com> wrote: > On 5/17/20, HH PackRat <hhpack...@gmail.com> wrote: > > I need to convert the following list of 5 (in reality, far more) > > 11-character dates: ... > > to a list of 5 boxed dates: ... > > Many THANK YOU's to those who responded! As usual with J, there's > often more than one way to accomplish something--in this case, 5 > completely different ways that I can choose to add to my personal J > vocabulary. > > The shortest was Skip Cave's response, but, Skip, I have a question > about how/why yours works. When I read the Vocabulary and NuVoc to > see how and why this works, I could not figure out how I would even > think to use "{" (catalogue) based on the information in those two > sources. The NuVoc definition/description is "Combines ITEMS from the > ATOMS inside a BOXED LIST to form a catalogue." My original list was > NOT boxed, so that description would automatically dismiss my example > from using "{". Can you please clarify why "{" can be used to box an > unboxed list? > > And, by the way, in my programming, I like to do things small step by > small step so that I can be sure everything works correctly at each > point. My original goal in this case was to get the unboxed list > first boxed in the correct manner and then transpose it from a column > to a row. (It's part of stock market data from a particular vendor > which is out of "standard" order and format.) Three of the five > responses did both aspects (box and transpose) in a single > command--for which I am quite grateful. It showed me again how > amazing J is! > > Harvey > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm