Skip to main content

All Questions

2 votes
1 answer
493 views

Eager map in Python

In Python the map function is lazy, but most often I need an eager map. For example, trying to slice a map object results in an error: >>>> map(abs, [3, -1, -4, 1])[1:] Traceback (most ...
user2373145's user avatar
1 vote
1 answer
332 views

Lazy evaluation of numpy.max

Suppose I have a 1D numpy array x with shape (n,) consisting mostly of zeros, and a 2D array Y with shape (m,n). I want to compute np.sum(x * np.max(Y,axis=0)) i.e. the dot product of x with the ...
mchristos's user avatar
  • 1,974
1 vote
1 answer
239 views

Is there any way to lazy evaluate function.func_name?

This question is not about my code I just want to claim the reason why I need lazy evalution on function.func_name I'm using a curry decorator in my code I made it to show curried arguments by ...
youfu's user avatar
  • 1,627
11 votes
5 answers
3k views

Lazy transform in C++

I have the following Python snippet that I would like to reproduce using C++: from itertools import count, imap source = count(1) pipe1 = imap(lambda x: 2 * x, source) pipe2 = imap(lambda x: x + 1, ...
bruno nery's user avatar
  • 2,052