I am trying to use the streaming package for lazy list operations demonstrated in this post. But I found that the package was significantly changed in version 11. After some observations, I found that LazyRange was moved to Streaming`ListAPI`Lazy`LazyRange, etc. However I encountered two problems in trivial tasks.

  1. Converting a lazy list to list. Leonid's post suggested Normal, which points to function Streaming`ListAPI`Eager`LazyListToList (this mapping is contained in Streaming`ListAPI`General`$StreamingAPIRegistry). Consider the following example:

ll = 2 # & /@ Streaming`ListAPI`Lazy`LazyRange[Infinity];
fl = Take[ll, 100];
(*part works correctly*)
(*long unexpected expression*)
(*same long unexpected expression*)
  1. Making a lazy tuple. I suppose it is similar(same) to Leonid's implementation here, however, both his example and ordinary syntax fail.

Streaming`ListAPI`Lazy`LazyTuples[{{1}, {2}}]
(*some uncaught errors*)

How to achieve the two tasks mentioned above?

  • 5
    $\begingroup$ I am afraid that Streaming in recent versions might be broken. I will try to set out some time to fix it soon, but certainly not for 11.2. Sorry about that. Streaming still does not have even an experimental status, and my development priorities in recent times didn't allow me to spend any significant time on it. But I will look into that, perhaps it is possible to produce a patch. I will come back to this discussion when I have more to say. $\endgroup$ Commented Aug 24, 2017 at 20:02
  • $\begingroup$ Ok, it is pretty badly broken, but I've digged into it and hopefully will have a patch soon. It works for me now, but I need to do more tests and refine it. Stay tuned. $\endgroup$ Commented Aug 24, 2017 at 21:49
  • 5
    $\begingroup$ Noticed this as well and just a vote for the potential value of the Streaming package both for computational experimentation and out-of-core data science applications. Hopefully a functioning version and some more questions on SE in routine usage might lift its status and development momentum. $\endgroup$ Commented Aug 24, 2017 at 23:21

1 Answer 1


The patch

Here is a way to get Streaming` working: on a fresh kernel execute the following:



If this worked, you should be able to use Streaming`. Note however, that the framework itself changed considerably. When time allows, I will try to provide some basic example of how it can be used.

Note also that while DownloadAndInstallStreamingPatch[] needs to be called only once (it installs the patch to your $UserBaseDirectory/ Applications), the Get["StreamingPatch`"] is needed to start every session with Streaming`.

Simple Tests

Here are a few simple tests to check that the patch worked (the patch loads Streaming` so one does not need to do that again, and actually should not).

ll = Streaming`LazyList`LazyListCreate[Range[100000], Byte[10000]]

Compute total:

Total @ ll

(*  5000050000 *)

A different way to do that:

Module[{sum = 0}, Scan[(sum += #) &, ll]; sum]

(*  5000050000 *)

Perform a chain of lazy transforms:

squared = Map[#^2 &, ll]
added = Map[# + 1 &, squared]
primes = Select[added, PrimeQ]

Convert to normal list:

Normal @ primes // Short

(*  {2,5,17,37,101,197,<<6645>>,9992001601,9995200577,9996800257,9998800037,9999200017} *)


Note that the patch has not been really tested more than very basic tests like the ones shown above. Please let me know if it does not work for you in some cases.

Note also, that Streaming` itself is undocumented functionality, for which there are no guarantees that it will not change in the future, or for that matter be present there at all. So use it at your own risk.

However, any feedback is very much appreciated.

  • 1
    $\begingroup$ B.t.w., I just checked that your examples in the question do work correctly with the patch. $\endgroup$ Commented Aug 24, 2017 at 23:07
  • 1
    $\begingroup$ Thank you very much! $\endgroup$
    – vapor
    Commented Aug 25, 2017 at 0:34
  • 1
    $\begingroup$ @happyfish You are welcome! Thanks for the accept. Let me know if you run into issues. $\endgroup$ Commented Aug 25, 2017 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.