In brief, I have the code below in Python
[n, m] = f()
and I want to convert it to Julia, which will not be more than one line (I hope).
Here is an example in Python:
from numpy import *
x = [0,1,2]
y = [3,4,5]
x = array(x)
y = array(y)
def f():
z = concatenate((x, y))
a = z*2
b = z*3
return [a, b]
def g():
[n,m] = f()
n = n/2
m = m/3
return [n, m]
print(g())
This is how I wanted it to be in Julia, but did not work:
x = [0,1,2]
y = [3,4,5]
function f()
z = vcat(x, y)
a = z*2
b = z*3
return [a, b]
end
function g()
[n, m] = f()
n = n/2
m = m/3
return [n, m]
end
print(g())
Here is how I made it work, but I do not want codes like this:
x = [0,1,2]
y = [3,4,5]
function f()
z = vcat(x, y)
a = z*2
b = z*3
global c = [a, b]
return c
end
function g()
n = c[1]
m = c[2]
n = n/2
m = m/3
return [n, m]
end
f()
print(g())
Thank you very much.