Skip to content
Snippets Groups Projects
Verified Commit c793b3bb authored by Martin Sjölund's avatar Martin Sjölund
Browse files

Update to Julia 1.2.0 (released Aug 20, 2019)

Julia 1.2.0 has more intuitive output for the memory profiler.
parent 9aff870b
Branches
Tags
No related merge requests found
*.tar.gz *.tar.gz
julia-1.0.4 julia-*
.PHONY: run .PHONY: run
run: julia-1.0.4/bin/julia VERSION=1.2.0
run: julia-$(VERSION)/bin/julia
$< run.jl $< run.jl
shell: julia-1.0.4/bin/julia shell: $(VERSION)/bin/julia
$< $<
julia-1.0.4/bin/julia: julia-1.0.4-linux-x86_64.tar.gz julia-%/bin/julia: julia-%-linux-x86_64.tar.gz
tar xzf $< tar xzf $<
$@ -e 'using Pkg; Pkg.add("BenchmarkTools"); Pkg.add("StatProfilerHTML")' $@ -e 'using Pkg; Pkg.add("BenchmarkTools"); Pkg.add("StatProfilerHTML")'
touch $@ touch $@
julia-1.0.4-linux-x86_64.tar.gz: julia-%-linux-x86_64.tar.gz:
wget https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.4-linux-x86_64.tar.gz wget https://julialang-s3.julialang.org/bin/linux/x64/`echo $@ | grep -E -o [0-9]+[.][0-9]+`/$@
"""Template programming is a sort of metaprogramming where you fill """Template programming is a sort of metaprogramming where you fill
in the blanks, but most parts of the code are very similar.""" in the blanks, but most parts of the code are very similar."""
# Problem1
for (name,op) in [(:add, :+), (:sub, :-), (:mul, :*)] for (name,op) in [(:add, :+), (:sub, :-), (:mul, :*)]
# Create a function that is named for example add and returns the # Create a function that is named for example add and returns the
# sum of its two arguments # sum of its two arguments
...@@ -14,19 +15,20 @@ end ...@@ -14,19 +15,20 @@ end
at runtime, but it is so similar to template programming that you could at runtime, but it is so similar to template programming that you could
try to delete a function instead.""" try to delete a function instead."""
module Problem1 module Problem2
f(a::Int) = 1 f(a::Int) = 1
f(a::Any) = 2 f(a::Any) = 2
end end
# TODO: Delete the method f(a::Int) so that f(1) returns the value 2 instead of 1 # TODO: Delete the method f(a::Int) so that f(1) returns the value 2 instead of 1
@assert 2 == Problem1.f(1) @assert 2 == Problem2.f(1)
# Problem3
# TODO: Make an until block for Julia, similar to do {} while (cond); in C # TODO: Make an until block for Julia, similar to do {} while (cond); in C
# #
# Make sure that any assertions and error-messages refer to lines in the original code. # Make sure that any assertions and error-messages refer to lines in the original code.
# Hint: You can access a hidden input __source__ in a macro and use that to replace source information. # Hint: You can access a hidden input __source__ in a macro and use that to replace source information.
# By having the macro in a separate file, you can check source locations that match dowhile.jl and replace them with __source__. # By having the macro in a separate file, you can check source locations that match dowhile.jl and replace them with __source__.
include("dowhile.jl") include("dowhile.jl") # Modify the macro in dowhile.jl
function testDoWhile() function testDoWhile()
local a = 5 local a = 5
@doWhile begin @doWhile begin
......
.PHONY: run .PHONY: run
run: ../julia/julia-1.0.4/bin/julia VERSION=1.2.0
run: ../julia/julia-$(VERSION)/bin/julia
$< test.jl $< test.jl
../julia/julia-1.0.4/bin/julia: ../julia/julia-$(VERSION)/bin/julia:
$(MAKE) -C ../julia julia-1.0.4/bin/julia $(MAKE) -C ../julia julia-$(VERSION)/bin/julia
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment