Combining Rows

27 views
Skip to first unread message

Skip Cave

unread,
May 21, 2024, 1:36:03 PMMay 21
to fo...@jsoftware.com
How does on combine multiple boxed rows into single boxed rows:
From:
image.png
to
image.png

Skip Cave
Cave Consulting LLC

Marcin Żołek

unread,
May 21, 2024, 2:08:41 PMMay 21
to fo...@jsoftware.com
How about this?

|:@,:@:(,&.>/"1) k

Marcin

On May 21, 2024, at 7:35 PM, 'Skip Cave' via forum <fo...@jsoftware.com> wrote:

How does on combine multiple boxed rows into single boxed rows:
From:
<image.png>
to
<image.png>

Skip Cave
Cave Consulting LLC

To unsubscribe from this group and stop receiving emails from it, send an email to forum+un...@jsoftware.com.

Brian Schott

unread,
May 21, 2024, 2:32:37 PMMay 21
to fo...@jsoftware.com
Try this.

,.,&.:>"1 k


Paul Jackson

unread,
May 21, 2024, 2:37:05 PMMay 21
to fo...@jsoftware.com

For rank 1 elements as in your example, I'd create them like this:
     (-2) ]\ 1 ;2 ;3;4 5;6 7;8 9 10

And join them like this:      ,. <@;"1 k


To unsubscribe from this group and stop receiving emails from it, send an email to forum+un...@jsoftware.com.

Henry Rich

unread,
May 21, 2024, 5:59:18 PMMay 21
to forum
<@;"1

Henry Rich

Henry Rich

unread,
May 21, 2024, 6:03:19 PMMay 21
to forum
I didn't see that I was duplicating Paul's work and lacking the trailing extra axis. 

Henry Rich 

Raul Miller

unread,
May 21, 2024, 7:53:18 PMMay 21
to fo...@jsoftware.com
I haven't seen anyone yet mention ,@<@;"1 which is how I would
approach this problem.

"1 to operate on rows
; to merge their contents
< to box those merged contents
, to turn each new box into a row

(with a couple instances of @ to glue the verbs together).

--
Raul


On Tue, May 21, 2024 at 10:36 AM 'Skip Cave' via forum
<fo...@jsoftware.com> wrote:
>
> How does on combine multiple boxed rows into single boxed rows:
> From:
>
> to
>
>
> Skip Cave
> Cave Consulting LLC
>

More Rice

unread,
May 21, 2024, 10:04:29 PMMay 21
to fo...@jsoftware.com
I had ,@<@;"1 as well; but it took me a while to see why I had to use , instead of ,. in tacit form - good one.

That said, I found Brian's use of Under quite elegant (applying obverse automatically).  Unfortunately, Open's padding got in the way for me and I had to go back to Raze.  Best I could think of is something like the following (timespacex not as good as Raul's version, of course; but just for learning purpose):

V =: ; :. <"1
(,:@,&.V) k

Could it be done better using Under?

thanks.

Maurice

Pascal Jasmin

unread,
May 22, 2024, 6:54:17 AMMay 22
to fo...@jsoftware.com
using under,

 ,. , each/"1 (-2) ]\ 1 ;2 ;3;4 5;6 7;8 9 10




Virus-free.www.avast.com

Skip Cave

unread,
May 23, 2024, 12:05:55 PMMay 23
to fo...@jsoftware.com
Looks like there are several different approaches to solving my problem:

Marcin:  |:@,:@:(,&.>/"1) k
Brian:  ,.,&.:>"1 k
Paul:    ,. <@;"1 k
Henry:  <@;"1 k
Raul:   ,@<@;"1 k
Maurice:  V =: ; :. <"1
              (,:@,&.V) k
Pascal:  ,. , each/"1 k

Is there any consensus on the most time/space efficient approach?

Skip

Henry Rich

unread,
May 23, 2024, 12:39:52 PMMay 23
to fo...@jsoftware.com
You don't want the consensus, you want the truth.  To find it use 6!:2 and 7!:2 on suitable data.

I would expect approaches using ,/ y to fare badly if y is long because the repeated prepending will have quadratic performance.  But it could be OK if y is short.

https://code.jsoftware.com/wiki/Vocabulary/SpecialCombinations has discussion of factors affecting performance.

Henry Rich

Mr. Brian B. McGuinness

unread,
May 23, 2024, 1:00:31 PMMay 23
to fo...@jsoftware.com
That is a useful and interesting link.  Thanks.

From: fo...@jsoftware.com <fo...@jsoftware.com> on behalf of Henry Rich <henry...@gmail.com>
Sent: Thursday, May 23, 2024 12:39 PM
To: fo...@jsoftware.com <fo...@jsoftware.com>
Subject: [External]Re: [Jforum] Combining Rows
 

Skip Cave

unread,
May 23, 2024, 4:51:22 PMMay 23
to fo...@jsoftware.com

Time/space check:


Generate k:

ts '$k=.|:sep ea 2 3^~/n=.1 to 1000'

0.0077972 377440


ts check:

]Marcin=: ts '|:@,:@:(,&.>/"1)k'

9.23e_5 271040

]Brian=: ts ',.,&.:>"1 k'

0.0001596 264544


]Paul=.ts ',. <@;"1 k'

4.32e_5 261472


]Henry=: ts '<@;"1 k'

4.78e_5 261344


]Raul=. ts ',@<@;"1 k'

0.0001899 261728


Maurice

V =: ; :. <"1

ts '(,:@,&.V) k'

0.0002203 262752


]Pascal=. ts ',. , each/"1 k'

6.68e_5 262368



Skip Cave
Cave Consulting LLC

Reply all
Reply to author
Forward
0 new messages