Re: [Jprogramming] Indvidual unboxing
Here you go sel =: (] ([ {~ (0&{"1@[ i. ])) <@[) 11 sel a ┌──┬─┐ │11│0 0 1 0 1│ └──┴─┘ 12 sel a ┌──┬───┐ │12│1 0 0 0 1 0 0 1│ └──┴───┘ If you were willing to flip the order of sel it could be slightly cleaner sel2=: (([ {~ (0&{"1@[ i. ])) <) a sel2 12 ┌──┬───┐ │12│1 0 0 0 1 0 0 1│ └──┴───┘ On Tue, Apr 10, 2018 at 2:12 PM, Skip Cave wrote: > Yes! Joe has the verb I need: > > tst > > ┌──┬─┐ > > │10│0│ > > ├──┼─┤ > > │10│0│ > > ├──┼─┤ > > │10│1│ > > ├──┼─┤ > > │10│0│ > > ├──┼─┤ > > │10│0│ > > ├──┼─┤ > > │10│0│ > > ├──┼─┤ > > │11│1│ > > ├──┼─┤ > > │11│0│ > > ├──┼─┤ > > │11│0│ > > ├──┼─┤ > > │11│0│ > > ├──┼─┤ > > │11│1│ > > ├──┼─┤ > > │12│1│ > > ├──┼─┤ > > │12│0│ > > ├──┼─┤ > > │12│0│ > > ├──┼─┤ > > │12│0│ > > ├──┼─┤ > > │12│0│ > > ├──┼─┤ > > │12│1│ > > ├──┼─┤ > > │12│1│ > > ├──┼─┤ > > │12│0│ > > └──┴─┘ > > > bx=: 3 : '|: (~. (0&{"1) y) ,: (0&{"1 <@;/. 1&{"1) y' > > ]a =: bx tst > > ┌──┬───┐ > > │10│0 0 1 0 0 0 │ > > ├──┼───┤ > > │11│1 0 0 0 1 │ > > ├──┼───┤ > > │12│1 0 0 0 0 1 1 0│ > > └──┴───┘ > > > Now I just need a select verb: > > > 11 sel a > > 1 0 0 0 1 > > > 12 sel a > > 1 0 0 0 0 1 1 0 > > > In other uses, the boolean string can be replaced by a character string, > > so the bx and sel verbs needs to handle all char types: > > > ]b > > ┌──┬───┐ > > │10│this is a test.│ > > ├──┼───┤ > > │11│Another test. │ > > ├──┼───┤ > > │12│The last test. │ > > └──┴───┘ > > > 11 sel b > > > Another test. > > > <<<>>> > > > Skip > > > Skip Cave > Cave Consulting LLC > > On Tue, Apr 10, 2018 at 12:51 PM, Joe Bogner wrote: > > > It sounds like maybe this is what you want? > > > > (0&{"1 > ┌──┬──┬──┐ > > │┌──┬─┐│┌──┬─┐│┌──┬─┐│ > > ││10│1│││11│0│││12│1││ > > │├──┼─┤│├──┼─┤│├──┼─┤│ > > ││10│1│││11│0│││12│0││ > > │├──┼─┤│├──┼─┤│├──┼─┤│ > > ││10│1│││11│1│││12│0││ > > │├──┼─┤│├──┼─┤│├──┼─┤│ > > ││10│0│││11│0│││12│0││ > > │├──┼─┤│├──┼─┤│├──┼─┤│ > > ││10│1│││11│1│││12│1││ > > │├──┼─┤│└──┴─┘│├──┼─┤│ > > ││10│1││ ││12│0││ > > │└──┴─┘│ │├──┼─┤│ > > │ │ ││12│0││ > > │ │ │├──┼─┤│ > > │ │ ││12│1││ > > │ │ │└──┴─┘│ > > └──┴──┴──┘ > > > > > > or > > > >|: (~. (0&{"1) tst) ,: (0&{"1 <@;/. 1&{"1) tst > > ┌──┬───┐ > > │10│1 1 1 0 1 1│ > > ├──┼───┤ > > │11│0 0 1 0 1 │ > > ├──┼───┤ > > │12│1 0 0 0 1 0 0 1│ > > └──┴───┘ > > > > > > > > > > > > On Tue, Apr 10, 2018 at 1:45 PM, 'Pascal Jasmin' via Programming < > > programm...@jsoftware.com> wrote: > > > > > if I understand correctly, there are 2 levels of boxing (or data can be > > > made into 2 level) such as > > > > > > <"1 <"0 ? 3 10 $ 2 > > > > > > then, this will unbox the inner set without introducing fills. > > > > > > ; each <"1 <"0 ? 3 10 $ 2 > > > > > > > > > > > > > > > > > > From: Skip Cave > > > To: "programm...@jsoftware.com" > > > Sent: Tuesday, April 10, 2018 1:32 PM > > > Subject: Re: [Jprogramming] Indvidual unboxing > > > > > > > > > > > > > > > I probably need to back up a step: > > > > > > My original data looks something like this: > > > > > > t=: 4 : '(y#x),.?y#2' > > > > > > ]tst=: > each(10 t 6),"2 (11 t 5), 12 t 8 > > > > > > ┌──┬─┐ > > > > > > │10│0│ > > > > > > ├──┼─┤ > > > > > > │10│1│ > > > > > > ├──┼─┤ > > > > > > │10│1│ > > > > > > ├──┼─┤ > > > > > > │10│1│ > > > > > > ├──┼─┤ > > > > > > │10│1│ > > > > > > ├──┼─┤ > > > > > > │10│0│ > > > > > >
Re: [Jprogramming] Indvidual unboxing
Yes! Joe has the verb I need: tst ┌──┬─┐ │10│0│ ├──┼─┤ │10│0│ ├──┼─┤ │10│1│ ├──┼─┤ │10│0│ ├──┼─┤ │10│0│ ├──┼─┤ │10│0│ ├──┼─┤ │11│1│ ├──┼─┤ │11│0│ ├──┼─┤ │11│0│ ├──┼─┤ │11│0│ ├──┼─┤ │11│1│ ├──┼─┤ │12│1│ ├──┼─┤ │12│0│ ├──┼─┤ │12│0│ ├──┼─┤ │12│0│ ├──┼─┤ │12│0│ ├──┼─┤ │12│1│ ├──┼─┤ │12│1│ ├──┼─┤ │12│0│ └──┴─┘ bx=: 3 : '|: (~. (0&{"1) y) ,: (0&{"1 <@;/. 1&{"1) y' ]a =: bx tst ┌──┬───┐ │10│0 0 1 0 0 0 │ ├──┼───┤ │11│1 0 0 0 1 │ ├──┼───┤ │12│1 0 0 0 0 1 1 0│ └──┴───┘ Now I just need a select verb: 11 sel a 1 0 0 0 1 12 sel a 1 0 0 0 0 1 1 0 In other uses, the boolean string can be replaced by a character string, so the bx and sel verbs needs to handle all char types: ]b ┌──┬───┐ │10│this is a test.│ ├──┼───┤ │11│Another test. │ ├──┼───┤ │12│The last test. │ └──┴───┘ 11 sel b Another test. <<<>>> Skip Skip Cave Cave Consulting LLC On Tue, Apr 10, 2018 at 12:51 PM, Joe Bogner wrote: > It sounds like maybe this is what you want? > > (0&{"1 ┌──┬──┬──┐ > │┌──┬─┐│┌──┬─┐│┌──┬─┐│ > ││10│1│││11│0│││12│1││ > │├──┼─┤│├──┼─┤│├──┼─┤│ > ││10│1│││11│0│││12│0││ > │├──┼─┤│├──┼─┤│├──┼─┤│ > ││10│1│││11│1│││12│0││ > │├──┼─┤│├──┼─┤│├──┼─┤│ > ││10│0│││11│0│││12│0││ > │├──┼─┤│├──┼─┤│├──┼─┤│ > ││10│1│││11│1│││12│1││ > │├──┼─┤│└──┴─┘│├──┼─┤│ > ││10│1││ ││12│0││ > │└──┴─┘│ │├──┼─┤│ > │ │ ││12│0││ > │ │ │├──┼─┤│ > │ │ ││12│1││ > │ │ │└──┴─┘│ > └──┴──┴──┘ > > > or > >|: (~. (0&{"1) tst) ,: (0&{"1 <@;/. 1&{"1) tst > ┌──┬───┐ > │10│1 1 1 0 1 1│ > ├──┼───┤ > │11│0 0 1 0 1 │ > ├──┼───┤ > │12│1 0 0 0 1 0 0 1│ > └──┴───┘ > > > > > > On Tue, Apr 10, 2018 at 1:45 PM, 'Pascal Jasmin' via Programming < > programm...@jsoftware.com> wrote: > > > if I understand correctly, there are 2 levels of boxing (or data can be > > made into 2 level) such as > > > > <"1 <"0 ? 3 10 $ 2 > > > > then, this will unbox the inner set without introducing fills. > > > > ; each <"1 <"0 ? 3 10 $ 2 > > > > > > > > > > > > From: Skip Cave > > To: "programm...@jsoftware.com" > > Sent: Tuesday, April 10, 2018 1:32 PM > > Subject: Re: [Jprogramming] Indvidual unboxing > > > > > > > > > > I probably need to back up a step: > > > > My original data looks something like this: > > > > t=: 4 : '(y#x),.?y#2' > > > > ]tst=: > each(10 t 6),"2 (11 t 5), 12 t 8 > > > > ┌──┬─┐ > > > > │10│0│ > > > > ├──┼─┤ > > > > │10│1│ > > > > ├──┼─┤ > > > > │10│1│ > > > > ├──┼─┤ > > > > │10│1│ > > > > ├──┼─┤ > > > > │10│1│ > > > > ├──┼─┤ > > > > │10│0│ > > > > ├──┼─┤ > > > > │11│0│ > > > > ├──┼─┤ > > > > │11│1│ > > > > ├──┼─┤ > > > > │11│0│ > > > > ├──┼─┤ > > > > │11│0│ > > > > ├──┼─┤ > > > > │11│0│ > > > > ├──┼─┤ > > > > │12│0│ > > > > ├──┼─┤ > > > > │12│1│ > > > > ├──┼─┤ > > > > │12│0│ > > > > ├──┼─┤ > > > > │12│1│ > > > > ├──┼─┤ > > > > │12│1│ > > > > ├──┼─┤ > > > > │12│1│ > > > > ├──┼─┤ > > > > │12│0│ > > > > ├──┼─┤ > > > > │12│0│ > > > > └──┴─┘ > > > > > > I want to box the boolean second column using the first column for an > > index: > > > > > > f1 tst > > > > ┌──┬───┐ > > > > │10│1 1 1 1 0 1 │ > > > > ├──┼───┤ > > > > │11│0 1 0 0 0 │ > > > > ├──┼───┤ > > > > │12│0 1 0 1 1 1 0 0│ > > > > └──┴───┘ > > > > > > Or maybe this is better if it get rid if the fills. > > > > > > f2 tst > > > > ┌──┬───┬──┬─┬──┬───┐ > > > > │10│1 1 1 1 0 1│11│0 1 0 0 0│12│0 1 0 1 1 1 0 0│ > > > > └──┴───┴──┴─┴──┴───┘ > > > > However, I need to find a boolean string givem it's index: 11 fb f2 tst > > > > > > ┌─┐ > > > > │0 1 0 0 0│ > > > > └─┘ > > > > 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/forums.htm > -- For information about J forums see http://www.jsoftware.com/forums.htm
Re: [Jprogramming] Indvidual unboxing
It sounds like maybe this is what you want? (0&{"1 wrote: > if I understand correctly, there are 2 levels of boxing (or data can be > made into 2 level) such as > > <"1 <"0 ? 3 10 $ 2 > > then, this will unbox the inner set without introducing fills. > > ; each <"1 <"0 ? 3 10 $ 2 > > > > > > From: Skip Cave > To: "programm...@jsoftware.com" > Sent: Tuesday, April 10, 2018 1:32 PM > Subject: Re: [Jprogramming] Indvidual unboxing > > > > > I probably need to back up a step: > > My original data looks something like this: > > t=: 4 : '(y#x),.?y#2' > > ]tst=: > each(10 t 6),"2 (11 t 5), 12 t 8 > > ┌──┬─┐ > > │10│0│ > > ├──┼─┤ > > │10│1│ > > ├──┼─┤ > > │10│1│ > > ├──┼─┤ > > │10│1│ > > ├──┼─┤ > > │10│1│ > > ├──┼─┤ > > │10│0│ > > ├──┼─┤ > > │11│0│ > > ├──┼─┤ > > │11│1│ > > ├──┼─┤ > > │11│0│ > > ├──┼─┤ > > │11│0│ > > ├──┼─┤ > > │11│0│ > > ├──┼─┤ > > │12│0│ > > ├──┼─┤ > > │12│1│ > > ├──┼─┤ > > │12│0│ > > ├──┼─┤ > > │12│1│ > > ├──┼─┤ > > │12│1│ > > ├──┼─┤ > > │12│1│ > > ├──┼─┤ > > │12│0│ > > ├──┼─┤ > > │12│0│ > > └──┴─┘ > > > I want to box the boolean second column using the first column for an > index: > > > f1 tst > > ┌──┬───┐ > > │10│1 1 1 1 0 1 │ > > ├──┼───┤ > > │11│0 1 0 0 0 │ > > ├──┼───┤ > > │12│0 1 0 1 1 1 0 0│ > > └──┴───┘ > > > Or maybe this is better if it get rid if the fills. > > > f2 tst > > ┌──┬───┬──┬─┬──┬───┐ > > │10│1 1 1 1 0 1│11│0 1 0 0 0│12│0 1 0 1 1 1 0 0│ > > └──┴───┴──┴─┴──┴───┘ > > However, I need to find a boolean string givem it's index: 11 fb f2 tst > > > ┌─┐ > > │0 1 0 0 0│ > > └─┘ > > 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/forums.htm
Re: [Jprogramming] Indvidual unboxing
if I understand correctly, there are 2 levels of boxing (or data can be made into 2 level) such as <"1 <"0 ? 3 10 $ 2 then, this will unbox the inner set without introducing fills. ; each <"1 <"0 ? 3 10 $ 2 From: Skip Cave To: "programm...@jsoftware.com" Sent: Tuesday, April 10, 2018 1:32 PM Subject: Re: [Jprogramming] Indvidual unboxing I probably need to back up a step: My original data looks something like this: t=: 4 : '(y#x),.?y#2' ]tst=: > each(10 t 6),"2 (11 t 5), 12 t 8 ┌──┬─┐ │10│0│ ├──┼─┤ │10│1│ ├──┼─┤ │10│1│ ├──┼─┤ │10│1│ ├──┼─┤ │10│1│ ├──┼─┤ │10│0│ ├──┼─┤ │11│0│ ├──┼─┤ │11│1│ ├──┼─┤ │11│0│ ├──┼─┤ │11│0│ ├──┼─┤ │11│0│ ├──┼─┤ │12│0│ ├──┼─┤ │12│1│ ├──┼─┤ │12│0│ ├──┼─┤ │12│1│ ├──┼─┤ │12│1│ ├──┼─┤ │12│1│ ├──┼─┤ │12│0│ ├──┼─┤ │12│0│ └──┴─┘ I want to box the boolean second column using the first column for an index: f1 tst ┌──┬───┐ │10│1 1 1 1 0 1 │ ├──┼───┤ │11│0 1 0 0 0 │ ├──┼───┤ │12│0 1 0 1 1 1 0 0│ └──┴───┘ Or maybe this is better if it get rid if the fills. f2 tst ┌──┬───┬──┬─┬──┬───┐ │10│1 1 1 1 0 1│11│0 1 0 0 0│12│0 1 0 1 1 1 0 0│ └──┴───┴──┴─┴──┴───┘ However, I need to find a boolean string givem it's index: 11 fb f2 tst ┌─┐ │0 1 0 0 0│ └─┘ 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
Re: [Jprogramming] Indvidual unboxing
I probably need to back up a step: My original data looks something like this: t=: 4 : '(y#x),.?y#2' ]tst=: > each(10 t 6),"2 (11 t 5), 12 t 8 ┌──┬─┐ │10│0│ ├──┼─┤ │10│1│ ├──┼─┤ │10│1│ ├──┼─┤ │10│1│ ├──┼─┤ │10│1│ ├──┼─┤ │10│0│ ├──┼─┤ │11│0│ ├──┼─┤ │11│1│ ├──┼─┤ │11│0│ ├──┼─┤ │11│0│ ├──┼─┤ │11│0│ ├──┼─┤ │12│0│ ├──┼─┤ │12│1│ ├──┼─┤ │12│0│ ├──┼─┤ │12│1│ ├──┼─┤ │12│1│ ├──┼─┤ │12│1│ ├──┼─┤ │12│0│ ├──┼─┤ │12│0│ └──┴─┘ I want to box the boolean second column using the first column for an index: f1 tst ┌──┬───┐ │10│1 1 1 1 0 1 │ ├──┼───┤ │11│0 1 0 0 0 │ ├──┼───┤ │12│0 1 0 1 1 1 0 0│ └──┴───┘ Or maybe this is better if it get rid if the fills. f2 tst ┌──┬───┬──┬─┬──┬───┐ │10│1 1 1 1 0 1│11│0 1 0 0 0│12│0 1 0 1 1 1 0 0│ └──┴───┴──┴─┴──┴───┘ However, I need to find a boolean string givem it's index: 11 fb f2 tst ┌─┐ │0 1 0 0 0│ └─┘ Skip -- For information about J forums see http://www.jsoftware.com/forums.htm
Re: [Jprogramming] Indvidual unboxing
Cliff's is best, as long as the boxed contents have rank < 2. Henry Rich On 4/10/2018 1:26 PM, Cliff Reiter wrote: ]a=:10 6 8 <@?@$"0] 2 +-+-+-+-+-+-+-+-+-+-+ |1|1|1|1|0|0|0|1|0|1| +-+-+-+-+-+-+-+-+-+-+ |0|1|1|1|0|1| | | | | +-+-+-+-+-+-+-+-+-+-+ |0|1|0|1|1|0|0|1| | | +-+-+-+-+-+-+-+-+-+-+ <@;"1 a +---+---+---+ |1 1 1 1 0 0 0 1 0 1|0 1 1 1 0 1|0 1 0 1 1 0 0 1| +---+---+---+ ,.<@;"1 a +---+ |1 1 1 1 0 0 0 1 0 1| +---+ |0 1 1 1 0 1 | +---+ |0 1 0 1 1 0 0 1 | +---+ On 4/10/2018 12:35 PM, Skip Cave wrote: NB.I have an array of boxed boolean values called tst: $tst 132 30 NB. I look at the first three rows of tst: 3{. tst ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ │0│1│1│1│0│1│1│0│0│1│0│1│1│0│1│1│1│1│0│0│0│1│1│0│0│1│1│1│ │ │ ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤ │0│1│1│1│0│1│0│1│1│0│0│1│0│1│0│1│1│ │ │ │ │ │ │ │ │ │ │ │ │ │ ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤ │0│1│1│0│1│0│1│0│1│0│1│0│1│0│1│0│0│1│0│1│0│1│0│1│0│0│0│1│0│0│ └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘ NB. I want to remove the individual boxing: f 3{. txt ┌───┐ │0 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 1 1 0 0 0 1 1 0 0 1 1 1 │ ├───┤ │0 1 1 1 0 1 0 1 1 0 0 1 0 1 0 1 1 │ ├───┤ │0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 0 0 1 0 0│ └───┘ NB. How do I construct the unboxing verb 'f'? 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 --- This email has been checked for viruses by AVG. http://www.avg.com -- For information about J forums see http://www.jsoftware.com/forums.htm
Re: [Jprogramming] Indvidual unboxing
]a=:10 6 8 <@?@$"0] 2 +-+-+-+-+-+-+-+-+-+-+ |1|1|1|1|0|0|0|1|0|1| +-+-+-+-+-+-+-+-+-+-+ |0|1|1|1|0|1| | | | | +-+-+-+-+-+-+-+-+-+-+ |0|1|0|1|1|0|0|1| | | +-+-+-+-+-+-+-+-+-+-+ <@;"1 a +---+---+---+ |1 1 1 1 0 0 0 1 0 1|0 1 1 1 0 1|0 1 0 1 1 0 0 1| +---+---+---+ ,.<@;"1 a +---+ |1 1 1 1 0 0 0 1 0 1| +---+ |0 1 1 1 0 1 | +---+ |0 1 0 1 1 0 0 1 | +---+ On 4/10/2018 12:35 PM, Skip Cave wrote: NB.I have an array of boxed boolean values called tst: $tst 132 30 NB. I look at the first three rows of tst: 3{. tst ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ │0│1│1│1│0│1│1│0│0│1│0│1│1│0│1│1│1│1│0│0│0│1│1│0│0│1│1│1│ │ │ ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤ │0│1│1│1│0│1│0│1│1│0│0│1│0│1│0│1│1│ │ │ │ │ │ │ │ │ │ │ │ │ │ ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤ │0│1│1│0│1│0│1│0│1│0│1│0│1│0│1│0│0│1│0│1│0│1│0│1│0│0│0│1│0│0│ └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘ NB. I want to remove the individual boxing: f 3{. txt ┌───┐ │0 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 1 1 0 0 0 1 1 0 0 1 1 1 │ ├───┤ │0 1 1 1 0 1 0 1 1 0 0 1 0 1 0 1 1 │ ├───┤ │0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 0 0 1 0 0│ └───┘ NB. How do I construct the unboxing verb 'f'? 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
Re: [Jprogramming] Indvidual unboxing
Your array seems odd: it has fills. Why? It appears you want to remove the fills, so methinks you should have boxed the rows, not the atoms in the rows. From where you start, you could delete the fills with <@:>@:(-.&a:)"1 to leave the fills, use <@:>"1 or its equivalent, ]&.:>"1 Henry Rich On 4/10/2018 12:35 PM, Skip Cave wrote: NB.I have an array of boxed boolean values called tst: $tst 132 30 NB. I look at the first three rows of tst: 3{. tst ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ │0│1│1│1│0│1│1│0│0│1│0│1│1│0│1│1│1│1│0│0│0│1│1│0│0│1│1│1│ │ │ ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤ │0│1│1│1│0│1│0│1│1│0│0│1│0│1│0│1│1│ │ │ │ │ │ │ │ │ │ │ │ │ │ ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤ │0│1│1│0│1│0│1│0│1│0│1│0│1│0│1│0│0│1│0│1│0│1│0│1│0│0│0│1│0│0│ └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘ NB. I want to remove the individual boxing: f 3{. txt ┌───┐ │0 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 1 1 0 0 0 1 1 0 0 1 1 1 │ ├───┤ │0 1 1 1 0 1 0 1 1 0 0 1 0 1 0 1 1 │ ├───┤ │0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 0 0 1 0 0│ └───┘ NB. How do I construct the unboxing verb 'f'? Skip -- For information about J forums see http://www.jsoftware.com/forums.htm --- This email has been checked for viruses by AVG. http://www.avg.com -- For information about J forums see http://www.jsoftware.com/forums.htm
Re: [Jprogramming] Indvidual unboxing
Or simply box each row. ,.<"1>tst ┌───┐ │1 1 0 0 0 0 1 1 0 0│ ├───┤ │1 1 1 0 1 1 1 1 0 0│ ├───┤ │0 0 0 0 0 1 0 1 1 0│ └───┘ On Tue, Apr 10, 2018 at 10:44 AM, Raul Miller wrote: > To get that exact result, I'd use >f=: ,@<@;"1 > > but I believe Don Guinn's proposal (f=: >) would be more useful. > > Thanks, > > -- > Raul > > On Tue, Apr 10, 2018 at 12:35 PM, Skip Cave > wrote: > > NB.I have an array of boxed boolean values called tst: > > $tst > > > > 132 30 > > > > NB. I look at the first three rows of tst: > > > > 3{. tst > > > > ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ > > > > │0│1│1│1│0│1│1│0│0│1│0│1│1│0│1│1│1│1│0│0│0│1│1│0│0│1│1│1│ │ │ > > > > ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤ > > > > │0│1│1│1│0│1│0│1│1│0│0│1│0│1│0│1│1│ │ │ │ │ │ │ │ │ │ │ │ │ │ > > > > ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤ > > > > │0│1│1│0│1│0│1│0│1│0│1│0│1│0│1│0│0│1│0│1│0│1│0│1│0│0│0│1│0│0│ > > > > └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘ > > NB. I want to remove the individual boxing: > > > > f 3{. txt > > > > ┌───┐ > > > > │0 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 1 1 0 0 0 1 1 0 0 1 1 1 │ > > > > ├───┤ > > > > │0 1 1 1 0 1 0 1 1 0 0 1 0 1 0 1 1 │ > > > > ├───┤ > > > > │0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 0 0 1 0 0│ > > > > └───┘ > > > > NB. How do I construct the unboxing verb 'f'? > > > > 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/forums.htm
Re: [Jprogramming] Indvidual unboxing
To get that exact result, I'd use f=: ,@<@;"1 but I believe Don Guinn's proposal (f=: >) would be more useful. Thanks, -- Raul On Tue, Apr 10, 2018 at 12:35 PM, Skip Cave wrote: > NB.I have an array of boxed boolean values called tst: > $tst > > 132 30 > > NB. I look at the first three rows of tst: > > 3{. tst > > ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ > > │0│1│1│1│0│1│1│0│0│1│0│1│1│0│1│1│1│1│0│0│0│1│1│0│0│1│1│1│ │ │ > > ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤ > > │0│1│1│1│0│1│0│1│1│0│0│1│0│1│0│1│1│ │ │ │ │ │ │ │ │ │ │ │ │ │ > > ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤ > > │0│1│1│0│1│0│1│0│1│0│1│0│1│0│1│0│0│1│0│1│0│1│0│1│0│0│0│1│0│0│ > > └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘ > NB. I want to remove the individual boxing: > > f 3{. txt > > ┌───┐ > > │0 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 1 1 0 0 0 1 1 0 0 1 1 1 │ > > ├───┤ > > │0 1 1 1 0 1 0 1 1 0 0 1 0 1 0 1 1 │ > > ├───┤ > > │0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 0 0 1 0 0│ > > └───┘ > > NB. How do I construct the unboxing verb 'f'? > > 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
Re: [Jprogramming] Indvidual unboxing
Just unbox it. <"0?3 10$2 ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ │1│1│1│1│1│0│1│0│1│1│ ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤ │0│0│1│1│1│0│1│1│0│1│ ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤ │0│0│0│1│1│1│0│0│1│1│ └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘ tst=:<"0?3 10$2 >tst 1 1 0 0 0 0 1 1 0 0 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 1 0 1 1 0 On Tue, Apr 10, 2018 at 10:35 AM, Skip Cave wrote: > NB.I have an array of boxed boolean values called tst: > $tst > > 132 30 > > NB. I look at the first three rows of tst: > > 3{. tst > > ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ > > │0│1│1│1│0│1│1│0│0│1│0│1│1│0│1│1│1│1│0│0│0│1│1│0│0│1│1│1│ │ │ > > ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤ > > │0│1│1│1│0│1│0│1│1│0│0│1│0│1│0│1│1│ │ │ │ │ │ │ │ │ │ │ │ │ │ > > ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤ > > │0│1│1│0│1│0│1│0│1│0│1│0│1│0│1│0│0│1│0│1│0│1│0│1│0│0│0│1│0│0│ > > └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘ > NB. I want to remove the individual boxing: > > f 3{. txt > > ┌───┐ > > │0 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 1 1 0 0 0 1 1 0 0 1 1 1 │ > > ├───┤ > > │0 1 1 1 0 1 0 1 1 0 0 1 0 1 0 1 1 │ > > ├───┤ > > │0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 0 0 1 0 0│ > > └───┘ > > NB. How do I construct the unboxing verb 'f'? > > 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