Well... since we're working with the result of i,.7 7 (and positive
offsets), one approach for finding the indices and offsets for an
arbitrary tiling would be to extract them from the values in the
tiles.

For example:

upperLeft=: 1 4,29 32,:15 18
lowerRight=: 18 19,32 33,:25 26
iotaDim=:7 7

indices=: iotaDim #: upperLeft
offsets=: 1+iotaDim #:lowerRight-upperLeft

   (i.7 7) ];.0~L:0 indices <@,:"1 offsets
+-----------+-----+
| 1  2  3  4| 4  5|
| 8  9 10 11|11 12|
|15 16 17 18|18 19|
+-----------+-----+
|29 30 31 32|32 33|
+-----------+-----+
|15 16 17 18|18 19|
|22 23 24 25|25 26|
+-----------+-----+

(And, for example, try changing just one value in upperLeft....)

(Note that it's mildly convenient to place the indices and offsets on
the right of the ;. conjunction here, because we need a character to
separate the ;.0 and L:0 for syntactic reasons. And, because that
expression tends to be longer. But we could just as easily have
reversed the argument order, with indices and offsets on the left of
;. and instead of ~ used a space.)

...

As for L: ....

L:0 applies the verb to unboxed data, and then boxes the intermediate
results to match boxing of the deepest of the argument fragments.

   (<1) +L:0 <<<2
+-----+
|+---+|
||+-+||
|||3|||
||+-+||
|+---+|
+-----+
   (1;<<<2) +L:0<<3
+---+-----+
|+-+|+---+|
||4|||+-+||
|+-+|||5|||
|   ||+-+||
|   |+---+|
+---+-----+

I hope this helps,

--
Raul
On Sun, Sep 26, 2021 at 7:03 AM 'Michael Day' via Programming
<[email protected]> wrote:
>
> Still trying to understand L: - it looks so useful,
> but meanwhile,  how do you get an even more irregular tiling such as:
>
> +-----------+-----+
> | 1  2  3  4| 4  5|
> | 8  9 10 11|11 12|
> |15 16 17 18|18 19|
> +-----------+-----+
> |29 30 31 32|32 33|
> +-----------+-----+
> |15 16 17 18|18 19|
> |22 23 24 25|25 26|
> +-----------+-----+
>
> NB. ie a 3 x 2 tiling ?
>
> This almost does the job:
>     [t1 =. <@,:"1/ ,"0"0 1"1/ >(0 3,.4 1,. 2 2);1 4,:4 2
> +---+---+---+
> |0 1|0 4|0 0|
> |3 4|3 2|3 0|
> +---+---+---+
> |4 1|4 4|4 0|
> |1 4|1 2|1 0|
> +---+---+---+
> |2 1|2 4|2 0|
> |2 4|2 2|2 0|
> +---+---+---+
> NB. or use Raul's latest posting as for t
> NB. ?
>
>     T ];.0~L:0 t1
> +-----------+-----++
> | 1  2  3  4| 4  5||
> | 8  9 10 11|11 12||
> |15 16 17 18|18 19||
> +-----------+-----++
> |29 30 31 32|32 33||
> +-----------+-----++
> |15 16 17 18|18 19||
> |22 23 24 25|25 26||
> +-----------+-----++
>
> So the current approach is fine for equal numbers of across and down
> tiles,  less good
> for unequal ones.  I suppose we can prune t1 to remove columns and/or
> rows having
> all zero lengths,  or remove all empty tiles.  In this case, the fact
> that there are 3
> columns and two columns in the specification might be used to filter the
> result.
>
> Cheers,
>
> Mike
>
> On 24/09/2021 17:54, R.E. Boss wrote:
> > This is the way to go for even very irregular tiling.
> > Let the starting points and their lengths be given per axis, like in
> >     (0 4,:3 1);1 4,:4 2
> > +---+---+
> > |0 4|1 4|
> > |3 1|4 2|
> > +---+---+
> > and
> >   [ T=.i.7 7
> >   0  1  2  3  4  5  6
> >   7  8  9 10 11 12 13
> > 14 15 16 17 18 19 20
> > 21 22 23 24 25 26 27
> > 28 29 30 31 32 33 34
> > 35 36 37 38 39 40 41
> > 42 43 44 45 46 47 48
> >
> > First make de tiling by indices
> >     t=.<@,:"1/ ,"0"0 1"1/ >(0 4,:3 1);1 4,:4 2
> > +---+---+
> > |0 1|0 4|
> > |3 4|3 2|
> > +---+---+
> > |4 1|4 4|
> > |1 4|1 2|
> > +---+---+
> > then
> >     T ];.0~L:0 t
> > +-----------+-----+
> > | 1  2  3  4| 4  5|
> > | 8  9 10 11|11 12|
> > |15 16 17 18|18 19|
> > +-----------+-----+
> > |29 30 31 32|32 33|
> > +-----------+-----+
> >
> > All credits to Miller.
> >
> >
> > R.E. Boss
> >
> >
> > -----Original Message-----
> > From: Programming <[email protected]> On Behalf Of 
> > R.E. Boss
> > Sent: vrijdag 24 september 2021 16:02
> > To: [email protected]
> > Subject: Re: [Jprogramming] irregular tillings
> >
> > This is probably the closest one could get, building the irregular tiling 
> > first in indices and then applying ;.0 Thanks.
> >
> >
> > R.E. Boss
> >
> >
> > -----Original Message-----
> > From: Programming 
> > <[email protected]<mailto:[email protected]>>
> >  On Behalf Of Raul Miller
> > Sent: vrijdag 24 september 2021 11:36
> > To: Programming forum 
> > <[email protected]<mailto:[email protected]>>
> > Subject: Re: [Jprogramming] irregular tillings
> >
> > Not easily (you could produce a larger result and discard the unwanted 
> > content).
> >
> > However, you could do this:
> >
> >     t=: 0 2 5 e.~i.7
> >     T=: i.7 7
> >     T];.0~L:0<@,."1/~(}:,.2-~/\])I.t,1
> > +-----+--------+-----+
> > |0 1  |2  3  4 | 5  6|
> > |7 8  |9 10 11 |12 13|
> > +-----+--------+-----+
> > |14 15|16 17 18|19 20|
> > |21 22|23 24 25|26 27|
> > |28 29|30 31 32|33 34|
> > +-----+--------+-----+
> > |35 36|37 38 39|40 41|
> > |42 43|44 45 46|47 48|
> > +-----+--------+-----+
> >
> > I hope this helps,
> >
> > --
> > Raul
> >
> > On Fri, Sep 24, 2021 at 4:32 AM R.E. Boss 
> > <[email protected]<mailto:[email protected]>> wrote:
> >> see https://code.jsoftware.com/wiki/Vocabulary/semidot3#dyadic
> >>
> >> Let
> >>     [t=.;2 3 2<@{."(0)1
> >> 1 0 1 0 0 1 0
> >>     T=:i.7 7
> >>
> >> then what I want is produced with
> >>
> >>     >,.&,.&.>/('';~t)<;.1 L:_ 0 ('';t)<;.1 T
> >> +-----+--------+-----+
> >> |0 1  |2  3  4 | 5  6|
> >> |7 8  |9 10 11 |12 13|
> >> +-----+--------+-----+
> >> |14 15|16 17 18|19 20|
> >> |21 22|23 24 25|26 27|
> >> |28 29|30 31 32|33 34|
> >> +-----+--------+-----+
> >> |35 36|37 38 39|40 41|
> >> |42 43|44 45 46|47 48|
> >> +-----+--------+-----+
> >>
> >> Is this (also) possible with <;.3  ?
> >>
> >>
> >> R.E. Boss
> >> ----------------------------------------------------------------------
> >> 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
>
>
> --
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to