Message Boards Message Boards

Lazy lists in Mathematica

POSTED BY: Sjoerd Smit
7 Replies
POSTED BY: Sander Huisman
POSTED BY: Sjoerd Smit
POSTED BY: Sander Huisman
POSTED BY: Paul Abbott
POSTED BY: Moderation Team

Good suggestion about Tuples. I added a lazyTuples function on my development branch, though it's probably not in its final form yet.

I based the methodology of off the SE answer below. It's well worth a read if you ever want to work with large numbers of tuples: https://mathematica.stackexchange.com/a/153609/43522

Edit I think I did everything I for the implementation of lazyTuples right now. In the future I may try to implement a feature to generate tuples in chunks rather than 1-by-1, but the current code should already work quite well.

POSTED BY: Sjoerd Smit

Lazy evaluation is quite handy in optimising interactive code like Manipulate when you don't want to compute a whole set of data anew prior to the start of Manipulate or at every "refresh".

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract