J - Scattered indexing 
Author Message
 J - Scattered indexing

I have a noun F containing (say) the contents of four text files, each
cut up as enclosed lines.

#F is 4
# each F is the number of lines in each file.

I want to do the following:

((0;10){::F) ; ((1;12){::F) ; ...etc...

to get the tenth line of the first file, the 12th of the second, etc...

using {:: I can only get one line at a time. Is there a clean way to
pass all the selection arguments at once to {:: in order to get any
scattered set of lines from F?

--

07/08/97 11:58
---------
Using: OUI PRO 1.5.0.2 from http://www.*-*-*.com/



Sat, 25 Dec 1999 03:00:00 GMT  
 J - Scattered indexing

Quote:
>I have a noun F containing (say) the contents of four text files, each
>cut up as enclosed lines.

>#F is 4
># each F is the number of lines in each file.

>I want to do the following:

>((0;10){::F) ; ((1;12){::F) ; ...etc...

>to get the tenth line of the first file, the 12th of the second, etc...

>using {:: I can only get one line at a time. Is there a clean way to
>pass all the selection arguments at once to {:: in order to get any
>scattered set of lines from F?

Both { and {:: can be used for this:

   f=. ;:'one two three four five six seven eight nine ten'
   F=. 1 0 0 1 0 1 0 0 1 0 <;.1 f

   2 1 0 1 { each F
+-------+------+-----+-----+
|+-----+|+----+|+---+|+---+|
||three|||five|||six|||ten||
|+-----+|+----+|+---+|+---+|
+-------+------+-----+-----+

   (1 2; 1; 0 1; 1) { each F
+-----------+------+-----------+-----+
|+---+-----+|+----+|+---+-----+|+---+|
||two|three|||five|||six|seven|||ten||
|+---+-----+|+----+|+---+-----+|+---+|
+-----------+------+-----------+-----+

   2 1 0 1 {:: each F
+-----+----+---+---+
|three|five|six|ten|
+-----+----+---+---+

   ((0;1),(0;2),(1;1),(2;0),(2;1),:(3;1)) {:: F
two  
three
five
six  
seven
ten  



Sun, 26 Dec 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. JS-EAI with *JS*-callback

2. js.exception 3279.js

3. RSECT & Scatter loading

4. RSECT & Scatter loading

5. Is use of scatter and gather functions redundant?

6. scatter plot

7. Scatter/Gather

8. gather() / scatter() ?

9. How to code volume surfaces and scatter plots?

10. Colored scatter plot with DISLIN graphical library

11. exact solution for scattering from a sphere routine

12. The Return of Gather/Scatter

 

 
Powered by phpBB® Forum Software