创建一个匿名函数作为第一个参数

    1. julia> function check(f::Function,n::Int)
    2. c=0
    3. for i in 1:n
    4. c+=f(i)
    5. end
    6. return c
    7. end
    8. check (generic function with 1 method)
    9. julia> check(8) do x
    10. 2*x
    11. end
    12. 72