15 January 2007
Lampson: Lazy and Speculative Execution
15
Lazy: Stream Processing
nIn database queries, Unix pipes, etc.,
oApply functions to unbounded sequences of data
▬f must be pointwise:  f (seq) = g(seq.head) Å f (seq.tail)
oRearrange the computation to apply several functions to each data item in turn
▬If f and g are pointwise, so is f ◦ g
oSometimes fails, as in piping to sort
nThe bet: don’t need the whole stream
nAlways a big win in latency
oIn fact, it can handle infinite structures