Created
September 7, 2014 00:06
-
-
Save Wilfred/4431fcb716feb3c20387 to your computer and use it in GitHub Desktop.
A simple swap macro
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
ERROR: b not defined | |
in include at boot.jl:245 | |
in include_from_node1 at loading.jl:128 | |
in process_options at client.jl:285 | |
in _start at client.jl:354 | |
while loading /home/wilfred/projects/comparative_macrology/swap.jl, in expression starting on line 3 |
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
macro swap!(x, y) | |
quote | |
tmp = $y | |
$x = $y | |
$y = tmp | |
end | |
end | |
a = 1 | |
b = 2 | |
# Runs fine if I comment out this line | |
@swap!(a, b) | |
println("a: $a, b: $b") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment