The Hamming number stream merges its shared multiples by two, three and five. To emit its first values, each of the fixed number of mapped streams and merge nodes advances at most positions. With lazy evaluation that shares each evaluated list cell, this takes comparisons and fixed-factor multiplications. The statement counts arithmetic operations, rather than bits: the growing exact integers make their bit-operation costs larger. Recomputing independent copies of the recursively defined stream loses this sharing argument.
Articles by others on the same topic
There are currently no matching articles.