Yes, this precisely the sort of thing I envisioned when considering how to create smarter generalizations of `known-finite?`. A good approach, however, is not yet clear to me; I need to spend more time experimenting. I’ve tried to find prior art in this area, but I haven’t been particular successful (though I’m not very experienced in looking for these kinds of things).
Certain bits are obvious: `take` always produces a finite stream, and `drop` and `map`/`filter` always preserve finiteness. Figuring out how to handle more flexible constructs like `fold` is less clear. It seems likely that a richer understanding of strictness and finiteness would be necessary to adequately describe all of the traditional primitives, but I’m not sure how clever such a system could really get. I’ll keep thinking about if there are better ways to encode this kind of behavior, but it seems impossible to solve the problem in general without losing significant expressiveness (a truly perfect solution to finiteness tracking would need to solve the halting problem). Alexis > On Jan 4, 2016, at 8:58 AM, Matthias Felleisen <[email protected]> wrote: > > > Please consider a more general way of specifying "strictness" patterns > for streams so that people can easily deal with finite and infinite > streams uniformly. > > I think the first step would be to develop some basic combinators for > taking/printing pieces of streams and combining those. The second one > might introduce a very small DSL so that plain users don't need the > combinators unless they have a very special need. > > -- Matthias -- You received this message because you are subscribed to the Google Groups "Racket Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-dev/68F26400-67AC-4C22-99FC-89CB06048171%40gmail.com. For more options, visit https://groups.google.com/d/optout.
