153 karma · joined April 24, 2018
https://github.com/jonathandata1/2022_beijing/blob/main/ille...
https://github.com/JuliaLang/julia/issues/1771
In particular:
https://github.com/JuliaLang/julia/issues/1771#issuecomment-...
Undoubtedly, it is a big surprise for new users (without exposure to free monoids :-)), that * is string concatenation.
By the way, in python juxtaposition ("abc" "def") is also valid.
https://github.com/JuliaLang/julia/blob/89a51fb98485219680c7...
This feature was discussed here: https://github.com/JuliaLang/julia/issues/21672
Test.@inferred is not quite what is needed:
function foo(x)
s = 0
# better use a zero of the same type than x
# s = zero(x)
for y in x
s += y
end
return s
end
Test.@inferred Float64 foo(12.1)
This test succeeds even if code is type-unstable[0] https://www.tensorflow.org/install/gpu [1] https://cuda.juliagpu.org/stable/installation/overview/
sum(j -> j*2.0^(-j),1:n)
sum(function,array) applies function to all elements of array before the summation (without need to allocate an intermediate array).
data = [1,2,3]
# . means element-wise operation
sum(exp.(filter(isodd,data)))
# or, where x |> f is f(x)
data |> x -> filter(isodd,x) .|> exp |> sum
Which looks quite clean to me. But Julia does not have partial function evaluation (just using filter(isodd) above would not work). Is this one of the main differences?
I do not think that this is a crazy idea at all [1]
Beside this, if you only infrequently install/update package, you can use PackageCompiler.jl. I use it for PyPlot.jl (based on matplotlib), DataFrames.jl, ... and plotting some data quasi instantaneous as it is in python (even the very first time in a session).
I think in julia this problem is solved quite nicely with the Project.toml (list of package that you directly dependent) and Manifest.toml file (the version numbers of the complete dependency tree which is automatically generated).
It seems that in groundhog you declare only direct dependencies. Is there a way to store the full dependency tree in R ?
Keeping a record of those who refused vaccination might not be necessary for this. In fact, somebody who refused vaccination is as much as a health risk as somebody who has not (yet) the possibility to get vaccinated.
But vaccinated people should have the possibility to prove that they are vaccinated and current social distancing rules should no longer apply to these people.
But the productivity boost of a REPL is undeniable and I use Julia mostly now. Interestingly, many skills to write high performant Fortran code (like the effective use of the processor cache), do actually translate to Julia.
julia> data = rand(ComplexF64, 1024^2);
# python fft from julia:
julia> res = @btime np.fft.fft(data);
78.613 ms (39 allocations: 16.00 MiB)
# python fft in ipython:In [11]: %timeit res = np.fft.fft(data)
89.3 ms ± 1.65 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
As expected, julia has its own fft package (based on FFTW):
julia> res = @btime fft(data);
61.540 ms (33 allocations: 16.00 MiB)For instance, in python you happily add a string to the list [1,2,3], but not in Julia because the list has been created as a vector of integers. However, if you create the list as Any[1,2,3], then you can append a variable of any type.
https://www.facebook.com/v6.0/plugins/like.php?action=like&a...
The original niche for which a programming language is designed may or may not be indicative for what it is used in the end. Julia strikes a very good balance between performance, flexibility (macros) and ease-of-use (default type inference). I won't be surprised if there are other niches outside of scientific computing where these characteristics are desirable.
The biggest obstacle I see for the adoption of Julia outside of the scientific computing realm are the latencies due to compilation. There are already 3-party solutions for this (like PackageCompiler{X,}.jl) but imho they are not robust yet enough for widespread adoption, but this might be about to change when different effort join forces [1].
[1] https://github.com/JuliaLang/PackageCompiler.jl/pull/304
[1] https://docs.julialang.org/en/v1/base/collections/#Base.sum!