Streams

There is a level at which everything in the outside world looks alike to a computer program. Unlike the computer memory area allocated for the use of a program, which is a sort of closed system, the outside world is full of moving, changing collections of information, which we can think of as flowing streams. You can dip your hands into a stream of water, take a drink, dip again, and drink again, but the stream is different the second time from the first, and so you are not drinking exactly the same water. Likewise, information gathered from a stream twice in the same way will often differ, whereas assigning a value twice from something that is not a stream almost always yields identical results (with a few exceptions such as rand and ...

Get Sams Teach Yourself Ruby in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.