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
using SimJulia, Distributions | |
@resumable function people(sim::Simulation, λ::Float64, clerk::Resource) | |
i = 1 | |
while true | |
Δt = rand(Exponential(1/λ)) | |
@yield return Timeout(sim, Δt) | |
@coroutine customer(sim, i, clerk) | |
i += 1 | |
end |
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
workspace() | |
function fibonnaci(a::Float64=0.0, b::Float64=1.0) :: Function | |
_state = 0x00 | |
function fib(ret::Any = nothing) :: Float64 | |
_state == 0x00 && @goto _STATE_0 | |
_state == 0x01 && @goto _STATE_1 | |
error("Iterator has stopped!") | |
@label _STATE_0 | |
_state = 0xff |
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
workspace() | |
function fibonnaci_yieldto(super::Task) | |
a = 0.0 | |
b = 1.0 | |
while true | |
yieldto(super, a) | |
a, b = b, a + b | |
end | |
end |