I will change NuVoc to indicate that this applies only to ;.3, not ;._3.
An important feature of ;._3, especially to the implementation, is that
all the cells have the same size, viz the size you asked for. Fragments
are discarded. It is possible to have 0 cells.
Henry Rich
On 11/1/2019 1:08 PM, Gilles Kirouac wrote:
The recent thread on odds and nths made me review the Cut conjunction
doing tessellation, i.e. case ;._3 .
About the tile size, both the Vocabulary and the NuVoc page specify
that an infinite size can be used:
Voc : an infinite size being replaced by the signed length of the
corresponding axis.
NuVoc : A value in the second row of x larger in magnitude than the
length of the axis causes that axis to be taken in full. Values of _ and
__ may be used.
In J807 and beta-n
(3,: 4) ];._3 ] 3 0 7 2 9 1 5 8 4 6 NB. overlap possible
3 0 7 2
2 9 1 5
5 8 4 6
(3,: 8) ];._3 ] 3 0 7 2 9 1 5 8 4 6
3 0 7 2 9 1 5 8
(3,: 10) ];._3 ] 3 0 7 2 9 1 5 8 4 6
3 0 7 2 9 1 5 8 4 6
(3,: 11) ];._3 ] 3 0 7 2 9 1 5 8 4 6 NB. oversize, empty result!
#(3,: 11) ];._3 ] 3 0 7 2 9 1 5 8 4 6 NB. I would expect 10
0
#(3,: _) ];._3 ] 3 0 7 2 9 1 5 8 4 6
0
~ Gilles
Le 2019-11-01 à 06:14, R.E. Boss a écrit :
3 (-@[{:\ -@(|#)}.]) 3 0 7 2 9 1 5 8 4 6
7 1 4
A simpler version (at least for me) of Rich's solution is
3 (,:~@[ {:;._3 ]) 3 0 7 2 9 1 5 8 4 6
7 1 4
R.E. Boss
-----Oorspronkelijk bericht-----
Van: Programming <[email protected]>
Namens 'Mike Day' via Programming
Verzonden: donderdag 31 oktober 2019 20:02
Aan: [email protected]
Onderwerp: Re: [Jprogramming] odds and nths
Unfortunately, Lorenz Koehl wants every item with an odd index, or with an
index equal to -1 modulo n.
So if
[q =. 10?10. NB. 3rd call of 10?10, I think
3 0 7 2 9 1 5 8 4 6
odd q NB. Koehl
0 2 1 8 6
3 nth q NB. Koehl
7 1 4
3 ({:;._3~ ,:~)~ q NB. Henry Rich
7 1 4
3(]#~<:@[=|)q NB. R E Boss
2 5 8
Henry’s method looks pretty minimal!
This doesn’t quite work in the general case, but fwiw, anyway:
_3 {: \ q. NB. !
7 1 4 6
Mike
PS I see you’ve just spotted the difference!
Sent from my iPad
On 31 Oct 2019, at 18:14, R.E. Boss <[email protected]> wrote:
And minus another one:
3(]#~<:@[=|)i.8
2 5
R.E. Boss
-----Oorspronkelijk bericht-----
Van: Programming <[email protected]>
Namens Raul Miller
Verzonden: donderdag 31 oktober 2019 18:27
Aan: Programming forum <[email protected]>
Onderwerp: Re: [Jprogramming] odds and nths
One character shorter:
3(]#~0=(|#\))i.8
2 5
Thanks,
--
Raul
On Thu, Oct 31, 2019 at 12:43 PM Henry Rich <[email protected]>
wrote:
3 ({:;._3~ ,:~)~ i. 8
2 5
Henry Rich
On 10/31/2019 12:33 PM, Lorenz Köhl wrote:
NB. get items with odd index
odd=. ] #~ 0 1 $~ #
Generalizing this I got
NB. get the nth items
nth=. ] #~ (1 ,~ 0 $~ 1 -~ [) $~ [: # ]
I bet this is not the shortest version!
I tried infix but it includes fret/fill
wrong_odd=. [: {: [: |: _2 ]\ ]
happy halloween
Lo
-------------------------------------------------------------------
-
-- For information about J forums see
http://www.jsoftware.com/forums.htm
--
This email has been checked for viruses by AVG.
https://www.avg.com
--------------------------------------------------------------------
--
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
----------------------------------------------------------------------
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