an adverb I think is useful

17 views
Skip to first unread message

Pascal Jasmin

unread,
Aug 13, 2025, 3:44:07 PMAug 13
to Forum
expandy =: 1 : '[ u ((,:@] $~ #@[)^:(~:&#))' NB. if x and y count don't agree, reshape y to match x count, assuming that y is a single item

at first glance / does a lot of this

1 2 3 +/ 1 2

2 3

3 4

4 5

1 2 3 + expandy 1 2

2 3

3 4

4 5

but

   1 2 3 +/ 1 2 3

2 3 4

3 4 5

4 5 6

1 2 3 + expandy 1 2 3

2 4 6


   1 2 3 +/ expandy 1 2

2 3

2 3

2 3




3 4

3 4

3 4




4 5

4 5

4 5


for functions that expect a match in count for x and y, I think the adverb helps.  Can still pass u/ to get "that behaviour" on the expanded y.

any improvements on generalization or criticism for being useless?

Raul Miller

unread,
Aug 14, 2025, 6:47:42 AMAug 14
to fo...@jsoftware.com
I guess I cannot imagine when I would find this useful.

It does avoid an error condition, but generally speaking errors are
thrown for situations where the coder has likely made a mistake.

This does not make it useless, of course. But this also does not make it useful.

--
Raul
> To unsubscribe from this group and stop receiving emails from it, send an email to forum+un...@jsoftware.com.
>
Reply all
Reply to author
Forward
0 new messages