On Sat, Jan 1, 2022 at 9:28 AM 'Michael Day' via Programming
<[email protected]> wrote:
> I can never remember the tessellation idiom when I need it,  ...

I have problems with this, also. So I made it a point, during AoC, to
try it out every few days so that my memory could remain fresh.

I tried a variety of examples, but the example which I find most
useful is this one:

   (1,:3 3) <;._3 i.4 4
+--------+--------+
|0 1  2  |1  2  3 |
|4 5  6  |5  6  7 |
|8 9 10  |9 10 11 |
+--------+--------+
| 4  5  6| 5  6  7|
| 8  9 10| 9 10 11|
|12 13 14|13 14 15|
+--------+--------+

If I had to, I would write a "tesselate" function which does what I
want (runs exactly once for each atom in the argument), but for most
cases it's "good enough" that I can use the primitive on a rank 2
array with a stride of 1 in both dimensions and a size of 3 in both
dimensions.

Problems with writing a general case tesselate function include:

(1) depending on the algorithm we might want to pad with fills or with
infinities or with some other "limit value".

(2) While tesselate is easily reasoned about for odd sized kernels
(where the center corresponds to an item of the argument array), it's
different for even sized kernels (where the center does not correspond
to an item of the argument array).

So.., constructing examples of the cut conjunction is about as good as
it gets here.

Thanks,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to