This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numba import jit, njit | |
# Define a global variable. | |
g = 0 | |
# foo doesn't care about the value of g at the time of definition. | |
@njit | |
def foo(): | |
# foo uses the global variable. | |
return g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module IteratedFunctions | |
export IteratedFunction, iterated | |
struct IteratedFunction{F} <: Function | |
f::F | |
n::UInt # ensure non-negative | |
end | |
IteratedFunction(f, n::Integer) = IteratedFunction(f, UInt(n)) |