Last active
June 14, 2019 19:15
-
-
Save simonbyrne/35f136e3891218a0458f97fe34b428c7 to your computer and use it in GitHub Desktop.
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 Cassette | |
Cassette.@context FizzBuzzCtx | |
function Cassette.overdub(ctx::FizzBuzzCtx, ::typeof(string), i::Integer) | |
if i % 3 == 0 | |
if i % 5 == 0 | |
"fizzbuzz" | |
else | |
"fizz" | |
end | |
else | |
if i % 5 == 0 | |
"buzz" | |
else | |
string(i) | |
end | |
end | |
end | |
function printnums(n) | |
for i = 1:n | |
println(i) | |
end | |
end | |
Cassette.overdub(FizzBuzzCtx(), printnums, 100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment