Skip to content

Instantly share code, notes, and snippets.

@simonbyrne
Last active June 14, 2019 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonbyrne/35f136e3891218a0458f97fe34b428c7 to your computer and use it in GitHub Desktop.
Save simonbyrne/35f136e3891218a0458f97fe34b428c7 to your computer and use it in GitHub Desktop.
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