Skip to content
Discussion options

You must be logged in to vote

Both cases are fine, becuase the functions you're using (loop_fun in the case of jit and the lambda in the case of scan) are non-side-effecting in themselves. The only side-effects that are problematic are those that happen across the boundaries of functions passed to transformations like jit or to higher-order primitives like scan.

You don't seem to be depending on the global state of counter being updated in either case, so your functions are effectively pure. Does that make sense?

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@HGangloff
Comment options

Answer selected by HGangloff
Comment options

You must be logged in to vote
3 replies
@jakevdp
Comment options

@nicolasJouvin
Comment options

@jakevdp
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants