3 ms·
Can you describe some situations in which this problem comes up? I'm having a hard time imagining when I would want/expect an iterator adaptor that does somethi
by gue5t 11y ago
Can you describe some situations in which this problem comes up? I'm having a hard time imagining when I would want/expect an iterator adaptor that does something useful on an empty/finished input.
- kybernetikos 11y agoIt's not so much empty/finished, it's that values are produced at particular times, perhaps as the user clicks the mouse, or as messages come in from the network or over stdin. Maybe you're writing some web page analytics software. Let's say you've got a stream of values representing the (x,y) positions of mouse clicks, you want to filter out any that are more than a predefined distance from a particular point, then remove any that occur 200ms or less than the last one, then every time you have 10 of them you want to post them to the server. How would you do this with iterator adaptors? With transducers, the exact same filter that removes points further than a particular distance away in the event stream can be used on any source (e.g. an iterator).