Convert a file of 4-byte cells from little to big endian or vice versa, by directly mapping it into memory and operating on it with sequence words:
USING: alien.c-types grouping io.mmap sequences
specialized-arrays ;
SPECIALIZED-ARRAY: char
"mydata.dat" char [
4 <groups>
[ reverse! drop ] each
] with-mapped-array
Normalize a file containing packed quadruples of floats:
USING: kernel io.mmap math.vectors math.vectors.simd
sequences specialized-arrays ;
SPECIALIZED-ARRAY: float-4
"mydata.dat" float-4 [
[ normalize ] map! drop
] with-mapped-array