building-a-matrix.rex |
Pipelines v2.1 |
.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10... |
**** Top of file ****
1
2 /* The following pipeline reads the file: aldous.txt; and builds a set of matrices. Each
3 matrix is 4 columns wide by 5 rows deep. The pipeline demonstrates the SNAKE stage
4 which builds multicolumn, aligned output records. */
5
6 Address Rxpipe
7
8 'pipe < &installdrive:\&installpath\examples\input\aldous.txt',
9 '| take 7', /* Select only the first 7 records. */
10 '| split', /* Split the records into individual words. */
11 '| specs recno strip 1.2 1-* nw', /* Insert the record number. */
12 '| snake 4 align / / 5 //', /* Build a set of matrices; each 4 columns.. */
13 , /* ..wide by 5 rows deep. */
14 '| cons' /* Display on the console. */
15
16 Say 'Hit Enter to close..'
17 Parse Pull
18
19 Exit 0
**** End of file ****
Console
output |
.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10...
1 1 A 6 only 11 main 16 LONDON
2 2 SQUAT 7 thirty-four 12 entrance 17 HATCHERY
3 3 grey 8 stories. 13 the 18 AND
4 4 building 9 Over 14 words, 19 CONDITIONING
5 5 of 10 the 15 CENTRAL 20 CENTRE,
6
7 21 and, 26 World 31 STABILITY. 36 on
8 22 in 27 State's 32 37 the
9 23 a 28 motto, 33 The 38 ground
10 24 shield, 29 COMMUNITY, 34 enormous 39 floor
11 25 the 30 IDENTITY, 35 room 40 faced
12
13 41 towards 46 all 51 panes, 56 heat
14 42 the 47 the 52 for 57 of
15 43 north. 48 summer 53 all 58 the
16 44 Cold 49 beyond 54 the 59 room
17 45 for 50 the 55 tropical 60 itself,
18
19 61 a 66 through 71 some 76 pallid
20 62 harsh 67 the 72 draped 77 shape
21 63 thin 68 windows, 73 lay
22 64 light 69 hungrily 74 figure,
23 65 glared 70 seeking 75 some
24 Hit Enter to close..
|