User loginNavigation |
lazy evaulation and combining user streamsI was looking at the SICP lectures the other day, and in the part on streams he talks about implementing a system with lazy evaluation, then gives as a example of the "dificulty" in combining streams a system that has 2 users entering data, each with their own stream, and something which has to choose which stream to take the next event from, while combining them into one stream. aparently the "problem" is that they try alternating between user streams, but one of the users may not enter anything for a while, causing the system to wait for him to enter something before continuing. It would seem to me that the problem here is not in the streams, but in the interface to the keyboard. The keyboard sends events. that means a charactor at a specific moment in time. of course normaly the time gets thrown out, but the event itself should be timestamped as the imput stream. This was even mentioned as a question, which he didn't adress very well. The next part is what should the keyboard stream return while "waiting" for a keystroke? It should return a "constraint object", which contains not a specifc value, but the constraint that the next data objects timestamp is greater then {current moment}. Then when the system goes to compile the streams, it can compile in timestamp order, and whenever it gets one item from one stream, it can just check the other stream to see if its next objects timestamp is greater then the curent object. Then add the first if it is, or add it if it is not. To start the process there would have to be a "current time" stream which the current time could be pulled from, and then the referened streams would be checked against it. Starting a stream access without checking if it's timestamp was less then the current time would be a error that would lock the system up till a event was entered. Just like taking the (cdr `()) is a error. So i don't see the problem. Is there something wrong with what i put forward, or did this problem just get solved after the videos were made (1980's)? By SphereOfDestiny at 2004-12-08 17:18 | LtU Forum | previous forum topic | next forum topic | other blogs | 6649 reads
|
Browse archives
Active forum topics |
Recent comments
22 weeks 6 days ago
22 weeks 6 days ago
22 weeks 6 days ago
45 weeks 19 hours ago
49 weeks 2 days ago
50 weeks 6 days ago
50 weeks 6 days ago
1 year 1 week ago
1 year 6 weeks ago
1 year 6 weeks ago