Stream-filter not in constant space?

The PR (https://github.com/racket/racket/pull/4554) was merged. The program in the OP should now run in constant space.

to @sorawee
Does your PR also solve problems with stream-map, stream-fold, in-stream and the like?
Jos

PS
I do not advocate the overloading of the stream-type.
In my humble opinion a list should not be a stream, as a string is not a list either.
I assume the requirement of backward compatibility inhibits the reversal of the overloading.

I think you made it clear that you don’t want lists to be used as streams. My thoughts are:

  1. Yes, I think the requirement of backward compatibility would inhibit any change there. Currently, it’s explicitly stated in the documentation that “plain lists can be used as streams”, so some users might rely on that behavior already.
  2. On the other hand, I don’t think using lists as streams is relevant to the original issue that you brought up. If it’s a topic that you would like to discuss more, I would recommend creating a new thread, and use this thread to only talk about the unexpected space consumption.

I fixed all the issues that I know about stream-map. I am not aware of any issue with stream-fold and in-stream. If you do, please let me know.