Not Skip, but let me take a crack at an explanation. I agree that NuVoc's wording makes it sound like monadic { doesn't work on unboxed lists. However...
{1 2 3 ┌─────┐ │1 2 3│ └─────┘ {<1 2 3 ┌─┬─┬─┐ │1│2│3│ └─┴─┴─┘ So { certainly does *something* to non-boxed arguments. From the documentation, monadic { takes the *items* of its argument, combining the atoms of each into some kind of Cartesian product. So perhaps an imperative programmer might think about monadic { as something like this: 1) Separate the argument into n=:#y items, 2) Unbox each item, enumerating these as u_1, u_2, ..., u_i, ..., u_n minding that unboxing a non-boxed noun is just a no-op, 3) Note the rank of each unboxed item, reshaping atomic u_i to 1-lists, 4) Form n-tuples (represented as boxed lists) from the atoms of each u_i, and 5) Combine the n-tuples into an array such that each k-cell that covers all the atoms of u_i has the same shape as u_i. So this solves the mystery with the example above---monadic { separates 1 2 3 into 1, 2, and 3, unboxes them (which is a no-op), turns them into 1-lists, and combines the (single) atoms of these lists into a (single) n-tuple. So, what about Skip's anwser? Well, consider the rank of { { b. 0 1 0 _ the first number of which represents monadic rank. Thus, Skip forms a table, where each array (row) is what you want boxed. Then, feeding this array to {, the J engine first splits the table into arrays, feeding each of these arrays to monadic { individually, which as we showed above effectively acts like < on the individual unboxed lists. Finally the J engine collects these results together into a rank n-1 array. Since our original array was rank 2, the result has rank 2-1 = 1. Clear as mud? If you *really* want the nitty gritty details, the jsource repository is fun to dig around in. Monadic { is implemented under jsrc/vfrom.c as the jtcatalog function. Keep in mind, though, the source departs wildly from your typical C idioms, favoring a style which looks and feels a lot more like J. More generally, when trying to puzzle through the behaviour of J verbs, conjunctions etc., I find it helpful to ask these questions: 1) What is it's rank? 2) How does it behave for different type/precision arguments? 3) Do complex arguments do something special? 4) If applicable, What do _ and/or __ do? 5) Do boxed arguments have special semantics (e.g. ^:)? 6) What about tolerance and precision? From my (albeit limited) experience, J verbs go to a lot of effort to be maximally general, so it pays to really think about corner cases or "wierd" values and types, e.g. <. on complex numbers. Cheers! 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