Linked Questions

18 votes
8 answers

How to map and sum a list fast?

The following takes a lot of memory and is slow: AbsoluteTiming[Total[Map[#^2 &, Range[1, 100000000]]]] I suspect this is because it first calculates and ...
3 votes
0 answers

How do I get built-in functions to use custom objects as if they were e.g. List?

(This is part 2 of my earlier question, Can I overload Part for specific heads (a la overloaded array subscripting)?, which was well-answered as asked.) Overview: My goal is to create a custom object -...
10 votes
2 answers

Breaking "Functional Loops" and Doing Lazy Evaluation In Mathematica

Alright, so this is a question about the functional way to break a for/while loop. Since we're on the Mathematica SE, I'm interested in the ways a Mathematica vet would handle this, however the ...
2 votes
0 answers

Is it possible to generate iterators dynamically during parallel processing?

I have a parallel processing code written in Wolfram Mathematica, similar to: ...
20 votes
1 answer

How to use Streaming package in v11.1?

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 ...
19 votes
5 answers

Append a list as a column in a dataset

I have a Dataset and a List, called dataset and intervals, and I would like to append the list as a new column of the dataset. I ...
3 votes
0 answers

What is the best equivalent way in MMA to micmicking python's generator expression?

In python, there is a syntax called generator expression. For example, [i for i in range(1,5)], [i**2 for i in range(1,5)], and <...
17 votes
4 answers

Lazy form of Tuples/Outer to loop over list of lists

This is less a question and more asking if someone has implemented this already, with more skill. I need to perform the Outer-like generalized outer product of a ...
4 votes
0 answers

Determining what symbols are defined in a DumpSave / .mx file [duplicate]

Against my better judgement, and in the interest of speedy I/O, I've decided to use .mx files for a project - limitations and all. I'm dealing with a few gigabyte-...
11 votes
1 answer

Alternative to Subsets to generate k-combinations

I need to generare a huge number of k-combinations for a quite big set of numbers (more than 100), so I would avoid Subsets because it requires too much memory (it generates all subsets at once). I ...
9 votes
0 answers

Performance improvements by using Activate and Inactivate

In a question about improving performance of a TensorContract of a TensorProduct, user jose suggested replacing ...
34 votes
1 answer

Efficient lazy weak compositions

In Mathematica all weak k-compositions of integer n can be generated using permutations of integer partitions: ...