Calling C and Fortran code is important for a scientific language due to legacy libraries, OpenMPI and other related work.
Manual - http://docs.julialang.org/en/release-0.2/manual/
(1+2)
(1+2)::Int
for x=1:5
println(x)
end
if a == 5
println("true")
end
Functions can have a number of methods (by defining the same function with different types)
Define a function with a body:
f(x::Float64, y::Float64) = 2x + y
f(x::Number, y::Number) = 2x - y
Inspect the function with:
f
Define a catch-all method for a function when a user passes an incorrect set of arguments:
f(x,y) = println("Whoa there, Nelly.")
http://docs.julialang.org/en/release-0.2/manual/metaprogramming/
macro time(ex)
quote
local t0 = time()
local val = $ex
local t1 = time()
println("elapsed time: ", t1-t0, " seconds")
val
end
end