Henry, Yes, I did see that part of the curlylf page. However, I was looking for a discussion of the pattern <<< and I didn't see it there. In fact, when I searched for the text "<<<" on the J Software site, I got zero hits. Well, I did get hits, but when I went to the link, there was never the <<< pattern.
I also searched for the word "except" which gave me 373 hits on the J Software site, more than I wanted to check. However, the top result did link to the curlylf page, but again with no <<<. Unfortunately, this experience is all too common for me as I try to learn J. J's re-defining of the semantics of programming terms makes it difficult to use word searches on the J Software site to discover how to create a specific function that I want to implement. Skip Skip Cave Cave Consulting LLC On Tue, Nov 8, 2016 at 6:25 AM, Henry Rich <[email protected]> wrote: > Did you look at > > http://code.jsoftware.com/wiki/Vocabulary/curlylf#Complement > ary_Indexing_and_Omitted_Axes > > ? It describes this, including pictures of selectors that produce various > results. > > Henry Rich > > On 11/8/2016 3:27 AM, Skip Cave wrote: > >> Rob, >> >> Thanks. 'Except' is a very useful tool to keep in my toolbox. Frankly, I >> think there needs to be a wiki page on the J Software site dedicated to >> exploring this option in more depth. I would have never found out about >> this if Raul hadn't pointed it out >> >> The idea is touched on briefly in the page Raul pointed out >> <http://www.jsoftware.com/help/dictionary/d520.htm>, and also hinted at >> briefly on the 'from' vocabulary page >> <http://code.jsoftware.com/wiki/Vocabulary/curlylf>, but I think the >> >> subject needs much more explanation. A search for 'except' on the J >> software site should lead one to a page full of examples as the top search >> result. The examples should start very simply, and gradually show more & >> more complex options. >> >> Skip >> >> Skip Cave >> Cave Consulting LLC >> >> On Tue, Nov 8, 2016 at 2:08 AM, Rob Hodgkinson <[email protected]> wrote: >> >> Hi Skip, >>> >>> 2 3 ((<@<@<@[){]) 1 2 3 4 5 >>> 1 2 5 >>> >>> ex=:(<@<@<@[){] >>> 2 3 ex 1 2 3 4 5 >>> 1 2 5 >>> >>> Rob >>> >>> >>> On 8 Nov. 2016, at 5:44 pm, Skip Cave <[email protected]> wrote: >>>> >>>> Aha! except! I had no idea that from '{' had such a useful option. >>>> >>>> (<<< 1 4 5 7) { 2 3 5 7 11 14 56 78 95 >>>> >>>> 2 5 7 56 95 NB. Cool! >>>> >>>> >>>> >>>> If i wanted to make a dyadic verb 'ex' that worked just like the above, >>>> >>> how >>> >>>> could I do that? >>>> >>>> >>>> 1 4 5 7 ex 2 3 5 7 11 14 56 78 95 >>>> >>>> 2 5 7 56 95 >>>> >>>> >>>> >>>> ex =: [:@<@<@<[{] >>>> >>>> 2 3 ex 1 2 3 4 5 >>>> >>>> |index error: ex >>>> >>>> | 2 3 ex 1 2 3 4 5 >>>> >>>> >>>> Nope! that didn't work. >>>> >>>> >>>> Skip >>>> >>>> Skip Cave >>>> Cave Consulting LLC >>>> >>>> On Tue, Nov 8, 2016 at 12:32 AM, Raul Miller <[email protected]> >>>> >>> wrote: >>> >>>> 2 { 2 3 5 7 11 >>>>> 5 >>>>> (<<<2) { 2 3 5 7 11 >>>>> 2 3 7 11 >>>>> >>>>> Look for the word "except" at http://www.jsoftware.com/help/ >>>>> dictionary/d520.htm >>>>> >>>>> Thanks, >>>>> >>>>> -- >>>>> Raul >>>>> >>>>> >>>>> On Tue, Nov 8, 2016 at 12:17 AM, Skip Cave <[email protected]> >>>>> wrote: >>>>> >>>>>> Nice! Xiao-Yong's verb does exactly what I need. >>>>>> >>>>>> f=:(] +:@{`[`]} <@<@<@]{[)"_ 0 [:I.2=/\] >>>>>> >>>>>> t =. 1 2 2 4 1 5 3 4 4 4 2 3 3 >>>>>> >>>>>> f t >>>>>> >>>>>> 1 4 4 1 5 3 4 4 4 2 3 3 >>>>>> >>>>>> 1 2 2 4 1 5 3 8 4 2 3 3 >>>>>> >>>>>> 1 2 2 4 1 5 3 4 8 2 3 3 >>>>>> >>>>>> 1 2 2 4 1 5 3 4 4 4 2 6 >>>>>> >>>>>> >>>>>> I can understand [:I.2=/\]. Using I. is the perfect way to find the >>>>>> indices of the dups. However, the rest of that big infinite-rank tacit >>>>>> expression to the left must generate each of the reduced items. I'm >>>>>> >>>>> totally >>>>> >>>>>> lost trying to figure that out. Why the zero? Why three <@? I thought >>>>>> [ >>>>>> represented a left argument, but there isn't a left argument. Any help >>>>>> >>>>> is >>> >>>> appreciated. >>>>>> >>>>>> >>>>>> Skip >>>>>> >>>>>> Skip Cave >>>>>> Cave Consulting LLC >>>>>> >>>>>> On Mon, Nov 7, 2016 at 10:25 PM, Xiao-Yong Jin <[email protected] >>>>>> > >>>>>> wrote: >>>>>> >>>>>> So you probably just need this: >>>>>>> f=:(] +:@{`[`]} <@<@<@]{[)"_ 0 [:I.2=/\] >>>>>>> or really the adverb >>>>>>> a=:1 :'u@(] +:@{`[`]} <@<@<@]{[)"_ 0 [:I.2=/\]' >>>>>>> >>>>>>> You may find different solutions if you abstract your problem >>>>>>> >>>>>> differently. >>>>> >>>>>> On Nov 7, 2016, at 9:30 PM, Skip Cave <[email protected]> >>>>>>>> >>>>>>> wrote: >>>>> >>>>>> Very interesting. Quite a difference in space and time usage, not to >>>>>>>> mention length of the tacit code. >>>>>>>> >>>>>>>> For my application, a rank 0 or 1 in the summed result isn't all >>>>>>>> that >>>>>>>> critical. As long as the contents of each box can be used in further >>>>>>>> arithmetic and Boolean operations (e.g. it's not text), then I'm ok. >>>>>>>> >>>>>>>> >>>>>>>> It looks like nouns with ranks 0 or 1 don't affect the outcome of >>>>>>>> >>>>>>> simple >>>>> >>>>>> arithmetic operations: >>>>>>>> >>>>>>>> >>>>>>>> ($4);($,4);(4=,4);(1+4);(1+,4);((1+4)=1+,4);($1+4);($1+,4) >>>>>>>> >>>>>>>> ┌┬─┬─┬─┬─┬─┬┬─┐ >>>>>>>> >>>>>>>> ││1│1│5│5│1││1│ >>>>>>>> >>>>>>>> └┴─┴─┴─┴─┴─┴┴─┘ >>>>>>>> >>>>>>>> The only time the difference becomes an issue: >>>>>>>> >>>>>>>> ($4)=($,4) >>>>>>>> >>>>>>>> |length error >>>>>>>> >>>>>>>> | ($4) =($,4) >>>>>>>> But I don't care about this. >>>>>>>> >>>>>>>> Actually, Mike Day spotted what I was really trying to attempt. >>>>>>>> The original starting vector is: >>>>>>>> >>>>>>>> n =: 1 2 2 4 1 5 3 4 4 4 2 3 3 >>>>>>>> >>>>>>>> Then I box at each possible pair of integers using an infix >>>>>>>> >>>>>>> sliding-window >>>>>>> >>>>>>>> on each pair of integers. This sliding box scheme was just to >>>>>>>> >>>>>>> identify >>> >>>> all >>>>>>> >>>>>>>> the duped pairs in the original vector. >>>>>>>> >>>>>>>> ]N =: 2<\pp >>>>>>>> >>>>>>>> ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ >>>>>>>> >>>>>>>> │1 2│2 2│2 4│4 1│1 5│5 3│3 4│4 4│4 4│4 2│2 3│3 3│ >>>>>>>> >>>>>>>> └───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┘ >>>>>>>> >>>>>>>> >>>>>>>> What I ultimately wanted is a verb that will replace the duped pairs >>>>>>>> >>>>>>> in >>>>> >>>>>> the >>>>>>> >>>>>>>> *original* un-boxed vector, one at a time: >>>>>>>> >>>>>>>> n =: 1 2 2 4 1 5 3 4 4 4 2 3 3 >>>>>>>> >>>>>>>> f n >>>>>>>> >>>>>>>> 1 4 4 1 5 3 4 4 4 2 3 3 >>>>>>>> >>>>>>>> 1 2 2 4 1 5 3 8 4 2 3 3 >>>>>>>> >>>>>>>> 1 2 2 4 1 5 3 4 8 2 3 3 >>>>>>>> >>>>>>>> 1 2 2 4 1 5 3 4 4 4 2 6 >>>>>>>> >>>>>>>> Of course, the final row lengths will be one shorter that the >>>>>>>> >>>>>>> original >>> >>>> row >>>>>>> >>>>>>>> length. >>>>>>>> >>>>>>>> Skip >>>>>>>> ------------------------------------------------------------ >>>>>>>> >>>>>>> ---------- >>>>> >>>>>> For information about J forums see http://www.jsoftware.com/ >>>>>>>> >>>>>>> forums.htm >>>>> >>>>>> ------------------------------------------------------------ >>>>>>> >>>>>> ---------- >>> >>>> For information about J forums see http://www.jsoftware.com/ >>>>>>> >>>>>> forums.htm >>> >>>> ---------------------------------------------------------------------- >>>>>> For information about J forums see http://www.jsoftware.com/forum >>>>>> s.htm >>>>>> >>>>> ---------------------------------------------------------------------- >>>>> For information about J forums see http://www.jsoftware.com/forums.htm >>>>> >>>>> ---------------------------------------------------------------------- >>>> For information about J forums see http://www.jsoftware.com/forums.htm >>>> >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm >>> >>> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
