Created
May 24, 2019 19:49
-
-
Save JeffBezanson/30c46a96f1743d3a92fbdd23779806d2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# run in commit c35d1d7f7c9d90e0a00ded1980d6fcd5d06f5433 | |
# fixed by commit f81d4d21862c99e1c0452bdf2613ab9e20da9935 | |
macro par(expr) | |
thunk = esc(:(()->($expr))) | |
quote | |
local task = Task($thunk) | |
task.sticky = false | |
schedule(task) | |
task | |
end | |
end | |
function pfib(n::Int) | |
if n <= 1 | |
return n | |
end | |
t = @par pfib(n-2) | |
return pfib(n-1) + fetch(t)::Int | |
end | |
pfib(31) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment