an attempt to port stream.js (lazy evaluation library) to C