传引用而不是传参数 pass by reference

    1. function f(x)
    2. x[1]=0
    3. return x
    4. end
    5. x=[1,2,3]
    6. f(x) # [0,2,3]
    7. x # [0,2,3]

    return type
    function(x,y)::Int8 #返回值是Int8类型
    只在julia无法判断返回类型时,才需要指定类型。
    return nothing 或者只写 return

    [1 2 3] #hcat
    [1, 2, 3] #vcat
    [1; 2; 3] #vcat

    g(x,y)=x+y,x*y
    匿名函数
    (x,y) -> x+y
    do block
    function mysum(f,x)
    out = zero(fx[1]))
    end
    return out
    end
    #do
    mysum(x) do x
    if x>0.5
    return x
    else
    return 0.5
    end
    end

    Julia字符串不能广播是最小单元,不是char的vector,也能用for in 迭代。与其他语言不同:”abc” * “def” 用乘法拼接字符串,join(R:paste)函数也可以用于拼接,支持分隔符。
    str_list=[“hello”,”world”,”julians!”]
    string(str_list…)

    • 字符串拼接

      1. "abc" * "def"
      2. join()
    • 字符串插值

      1. name = "3C"
      2. "hello world $name"
      3. x=[1,2,3]
      4. "the sum of $x is $(sum(x))"
    • raw ```julia str = raw””” Hello \n world “””

    “Hello \n\nworld\n”

    1. - 查找
    2. strartswith(x,"xy")<br />endswith(x,"apple")<br />findfisrt(isequal('p'),"apple")<br />occusin("a","apple")<br />x=[1,2,3]
    3. - reduce(+,x) == 1+2+3
    4. - map(abs2,x) == 1+2+3
    5. - mapreduce(abs2,+,x)
    6. - foreach 无返回值 map 有返回值
    7. Function<br />传引用而不是传参数 pass by reference
    8. ```julia
    9. function f(x)
    10. x[1]=0
    11. return x
    12. end
    13. x=[1,2,3]
    14. f(x) # [0,2,3]
    15. x # [0,2,3]

    return type
    function(x,y)::Int8 #返回值是Int8类型
    只在julia无法判断返回类型时,才需要指定类型。
    return nothing 或者只写 return

    [1 2 3] #hcat
    [1, 2, 3] #vcat
    [1; 2; 3] #vcat

    g(x,y)=x+y,x*y
    匿名函数
    (x,y) -> x+y
    do block
    function mysum(f,x)
    out = zero(fx[1]))
    end
    return out
    end
    #do
    mysum(x) do x
    if x>0.5
    return x
    else
    return 0.5
    end
    end