]b =. 100 200 300 400 (+ i.)&.> 1 4 2 3 NB. 4 variable-length records
+---+---------------+-------+-----------+
|100|200 201 202 203|300 301|400 401 402|
+---+---------------+-------+-----------+
]r =. ; (>:@# , ])&.> b NB. encode as length-then-data
2 100 5 200 201 202 203 3 300 301 4 400 401 402
]rr =. _1 ,~ (+ i.@#) r NB. convert each len to index of next rcd
2 101 7 203 205 207 209 10 308 310 14 411 413 415 _1
]rcds =. rr {~^:a: 0 NB. find record positions
0 2 7 10 14 _1
]s =. 1 _1 +"1 (2) -~/\\ }: rcds NB. convert to start/length of
each record
1 1
3 4
8 2
11 3
(,."1 s) <;.0 r NB. extract data & box
+---+---------------+-------+-----------+
|100|200 201 202 203|300 301|400 401 402|
+---+---------------+-------+-----------+
Henry Rich
> To unsubscribe from this group and stop receiving emails from it, send an email to
forum+un...@jsoftware.com.
>