Earlier quoted context omitted.
Would you be able to use Octave for reading from stdin?
Yes, Sprint suggested this: octave -q --eval "mean = mean(load('$1'))" But, again, octave requires more time to warm up...
Basically you just need to write an octave function that reads values from the terminal.