# General Usage

**URL:** https://discourse.julialang.org/c/usage/6.md?page=935

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 936

---

## [Dispatch on parametric subtypes](https://discourse.julialang.org/t/dispatch-on-parametric-subtypes/15542)

<div class="topic-metadata">

**Author:** [@mcognetta](https://discourse.julialang.org/u/mcognetta)\
**Replies:** 2\
**Last updated:** [September 27, 2018, 10:00am UTC](https://discourse.julialang.org/t/dispatch-on-parametric-subtypes/15542 "2018-09-27T10:00:38Z")

</div>

I asked this question on the Julia Slack and got a reasonable fix but I am wondering if there is a better solution (specifically one that works entirely via multiple dispatch). Suppose I have the following set up: abs…

---

## [How to find out why I cannot install a package](https://discourse.julialang.org/t/how-to-find-out-why-i-cannot-install-a-package/15517)

<div class="topic-metadata">

**Author:** [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Replies:** 2\
**Last updated:** [September 27, 2018, 7:39am UTC](https://discourse.julialang.org/t/how-to-find-out-why-i-cannot-install-a-package/15517 "2018-09-27T07:39:22Z")

</div>

I cannot figure out why I cannot develop the MLKernels package. How do I figure out the package responsible for restricting the requirement to 0.3.0? Are there already tools to explore dependency graphs? pkg\> st gives…

---

## [StatsPlots precompile all the time....?](https://discourse.julialang.org/t/statsplots-precompile-all-the-time/14607)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 4\
**Last updated:** [September 27, 2018, 7:20am UTC](https://discourse.julialang.org/t/statsplots-precompile-all-the-time/14607 "2018-09-27T07:20:58Z")

</div>

This is really weird… StatPlots does not remember that it’s already precompiled… (v0.7) pkg\> precompile Precompiling project... Precompiling StatPlots \[ Info: Precompiling StatPlots \[60ddc479-9b66-56df-82fc-76a74619b69c…

---

## [Bug in Expectations.jl?](https://discourse.julialang.org/t/bug-in-expectations-jl/15524)

<div class="topic-metadata">

**Author:** [@IljaK91](https://discourse.julialang.org/u/IljaK91)\
**Replies:** 4\
**Last updated:** [September 27, 2018, 6:00am UTC](https://discourse.julialang.org/t/bug-in-expectations-jl/15524 "2018-09-27T06:00:00Z")

</div>

Hey everyone, I wanted to use Expectations.jl and I think this constitutes an error? using Distributions, Expectations E = expectation(Normal(1, 1)) E(x -\> x) with the result being julia\> E(x -\> x) 5.7785443347337…

---

## [Compilation fails CSV upgrade from @0.3.1 to 0.4.0](https://discourse.julialang.org/t/compilation-fails-csv-upgrade-from-0-3-1-to-0-4-0/15541)

<div class="topic-metadata">

**Author:** [@Ajaychat3](https://discourse.julialang.org/u/Ajaychat3)\
**Replies:** 2\
**Last updated:** [September 27, 2018, 5:03am UTC](https://discourse.julialang.org/t/compilation-fails-csv-upgrade-from-0-3-1-to-0-4-0/15541 "2018-09-27T05:03:26Z")

</div>

CSV@0.3.1 is working fine on my Win 10 PC with Julia 1.0. When I do package update it move to CSV@0.4.0 and also removes InternedStrings package. However CSV fails to compile. When I revert back to CSV@0.3.1 (with Intern…

---

## [How to find the version of a package?](https://discourse.julialang.org/t/how-to-find-the-version-of-a-package/15533)

<div class="topic-metadata">

**Author:** [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Replies:** 1\
**Last updated:** [September 27, 2018, 4:35am UTC](https://discourse.julialang.org/t/how-to-find-the-version-of-a-package/15533 "2018-09-27T04:35:17Z")

</div>

In a package’s folder under ~/.julia/packages, there are a few folders with cryptic names. How can I find out which fold is of which version of the package? Or, how can I find out the version of a package I am currentl…

---

## [Error with package versions when installing Merlin.jl in Julia 1.0](https://discourse.julialang.org/t/error-with-package-versions-when-installing-merlin-jl-in-julia-1-0/15540)

<div class="topic-metadata">

**Author:** [@1113](https://discourse.julialang.org/u/1113)\
**Replies:** 0\
**Last updated:** [September 27, 2018, 4:11am UTC](https://discourse.julialang.org/t/error-with-package-versions-when-installing-merlin-jl-in-julia-1-0/15540 "2018-09-27T04:11:03Z")

</div>

Error occur when I was trying to install Merlin.jl package with Pkg in Julia 1.0. It is really confusing as it is not explicitly shown which requirement is unsatisfied. Error message: julia\> Pkg.add(“Merlin”) Updati…

---

## [Problem creating new topic in forum with Chrome](https://discourse.julialang.org/t/problem-creating-new-topic-in-forum-with-chrome/15531)

<div class="topic-metadata">

**Author:** [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Replies:** 2\
**Last updated:** [September 27, 2018, 1:28am UTC](https://discourse.julialang.org/t/problem-creating-new-topic-in-forum-with-chrome/15531 "2018-09-27T01:28:49Z")

</div>

I have been using Firefox to access this forum, but recently found that it uses too much memory, so I started doing it from Chrome. In Chrome, when I click New Topic, say under the view of Usage, I initially get the edi…

---

## [Defining custom show method on REPL for custom Array](https://discourse.julialang.org/t/defining-custom-show-method-on-repl-for-custom-array/15519)

<div class="topic-metadata">

**Author:** [@favba](https://discourse.julialang.org/u/favba)\
**Replies:** 2\
**Last updated:** [September 26, 2018, 2:48pm UTC](https://discourse.julialang.org/t/defining-custom-show-method-on-repl-for-custom-array/15519 "2018-09-26T14:48:52Z")

</div>

I’m trying to define a custom show method for my TestArray below: struct TestA{T} \<: AbstractVector{T} a::Vector{T} b::Vector{Complex{T}} isita::Base.RefValue{Bool} end TestA() = TestA{Float64}(rand(Float64,3)…

---

## [Combining two arrays with alternating elements](https://discourse.julialang.org/t/combining-two-arrays-with-alternating-elements/15498)

<div class="topic-metadata">

**Author:** [@Gregory\_Martinez](https://discourse.julialang.org/u/Gregory_Martinez)\
**Replies:** 10\
**Last updated:** [September 26, 2018, 1:15pm UTC](https://discourse.julialang.org/t/combining-two-arrays-with-alternating-elements/15498 "2018-09-26T13:15:18Z")

</div>

I wish to combine two arrays, lets say a = \[1, 2, 3, …\] and b = \[4, 5, 6, …\], so that the elements alternate between them like so: c = \[1, 4, 2, 5, 3, 6, …\]. My first attempt was to make an “my\_combine” object like so: …

---

## [Any experience with julia on AWS CfnCluster?](https://discourse.julialang.org/t/any-experience-with-julia-on-aws-cfncluster/15512)

<div class="topic-metadata">

**Author:** [@floswald](https://discourse.julialang.org/u/floswald)\
**Replies:** 0\
**Last updated:** [September 26, 2018, 12:26pm UTC](https://discourse.julialang.org/t/any-experience-with-julia-on-aws-cfncluster/15512 "2018-09-26T12:26:39Z")

</div>

hi, i’d like to use this to create a cluster on AWS AWS Workshops and wanted to know if anyone had tried this out already. In particular: any guidance on AMI’s to use? thanks.

---

## [CSV compile error in Julia-1.0](https://discourse.julialang.org/t/csv-compile-error-in-julia-1-0/14933)

<div class="topic-metadata">

**Author:** [@Ajaychat3](https://discourse.julialang.org/u/Ajaychat3)\
**Replies:** 6\
**Last updated:** [September 26, 2018, 12:25pm UTC](https://discourse.julialang.org/t/csv-compile-error-in-julia-1-0/14933 "2018-09-26T12:25:38Z")

</div>

I am trying to compile CSV on julia-1.0 on win 10 and the following error gets thrown. Am I doing something wrong? ┌ Info: Precompiling CSV \[336ed68f-0bac-5ca0-87d4-7b16caf5d00b\] └ @ Base loading.jl:1186 ERROR: LoadErro…

---

## [\`string(dict)\` loses information](https://discourse.julialang.org/t/string-dict-loses-information/15489)

<div class="topic-metadata">

**Author:** [@paalon](https://discourse.julialang.org/u/paalon)\
**Replies:** 5\
**Last updated:** [September 26, 2018, 10:53am UTC](https://discourse.julialang.org/t/string-dict-loses-information/15489 "2018-09-26T10:53:48Z")

</div>

string(dict) loses information if dict contains Float64. How to avoid this behavior? # on v1.0 x = 1.000000101e8 # Float64 y = 2.000000202e8 # Float64 d = Dict("x"=\>x, "y"=\>y) d2 = eval(Meta.parse(string(d))) d\["x"\] =…

---

## [Use a string with interpolations as function argument and interpolate later](https://discourse.julialang.org/t/use-a-string-with-interpolations-as-function-argument-and-interpolate-later/15505)

<div class="topic-metadata">

**Author:** [@stakaz](https://discourse.julialang.org/u/stakaz)\
**Replies:** 2\
**Last updated:** [September 26, 2018, 9:41am UTC](https://discourse.julialang.org/t/use-a-string-with-interpolations-as-function-argument-and-interpolate-later/15505 "2018-09-26T09:41:51Z")

</div>

Hello, I can use this code easily to produce a tuple (or array) of strings: julia\> Tuple("a$(a)\_b$(b)" for (a,b) ∈ Iterators.product(1:2, 3:4)) ("a1\_b3", "a2\_b3", "a1\_b4", "a2\_b4") However I cannot make a function from…

---

## [Broadcasting over structs in 1.0: what am I supposed to do?](https://discourse.julialang.org/t/broadcasting-over-structs-in-1-0-what-am-i-supposed-to-do/13408)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 3\
**Last updated:** [September 26, 2018, 6:52am UTC](https://discourse.julialang.org/t/broadcasting-over-structs-in-1-0-what-am-i-supposed-to-do/13408 "2018-09-26T06:52:59Z")

</div>

Hi all- I commonly broadcast over structs with the dot syntax. While updating my code, I was dismayed to see this is longer a simple process. Here is a minimum working example just for reference: mutable struct M x…

---

## [Dot function](https://discourse.julialang.org/t/dot-function/8644)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 45\
**Last updated:** [September 26, 2018, 1:14am UTC](https://discourse.julialang.org/t/dot-function/8644 "2018-09-26T01:14:05Z")

</div>

I’m looking at some Numpy code and try to convert it to Julia for performance comparison. (If you’re interested, it’s the logistic regression example from Numba project.) I realized that Numpy’s dot function possess a…

---

## [Embedding and include](https://discourse.julialang.org/t/embedding-and-include/13524)

<div class="topic-metadata">

**Author:** [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Replies:** 3\
**Last updated:** [September 25, 2018, 11:31pm UTC](https://discourse.julialang.org/t/embedding-and-include/13524 "2018-09-25T23:31:48Z")

</div>

What is the story with include in embedded Julia on 0.7+? If, for example, you add checked\_eval\_string("include(\\"LocalModule.jl\\")"); in the embedding example (test/embedding/embedding.c), the result is Undef…

---

## [Can't pass \`nothing\` to macro](https://discourse.julialang.org/t/cant-pass-nothing-to-macro/15468)

<div class="topic-metadata">

**Author:** [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)\
**Replies:** 4\
**Last updated:** [September 25, 2018, 8:09pm UTC](https://discourse.julialang.org/t/cant-pass-nothing-to-macro/15468 "2018-09-25T20:09:36Z")

</div>

I am running julia 1.0 on Manjaro Linux. I have created a macro like this, which can generate a power function, with optionally a constant offset and/or a constant factor: macro pow(functionname::Symbol, pow::Int, add::…

---

## [Warning when using PlotlyJS.jl + Distributions.jl](https://discourse.julialang.org/t/warning-when-using-plotlyjs-jl-distributions-jl/15479)

<div class="topic-metadata">

**Author:** [@v-i-s-h](https://discourse.julialang.org/u/v-i-s-h)\
**Replies:** 0\
**Last updated:** [September 25, 2018, 4:54pm UTC](https://discourse.julialang.org/t/warning-when-using-plotlyjs-jl-distributions-jl/15479 "2018-09-25T16:54:09Z")

</div>

Hi, When I try to use both PlotlyJS and Distributions, I get this warning. \_ \_ \_ \_(\_)\_ | Documentation: https://docs.julialang.org (\_) | (\_) (\_) | \_ \_ \_| |\_ \_\_ \_ | Type "?…

---

## [Interfacing rust?](https://discourse.julialang.org/t/interfacing-rust/6389)

<div class="topic-metadata">

**Author:** [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Replies:** 6\
**Last updated:** [September 25, 2018, 2:13pm UTC](https://discourse.julialang.org/t/interfacing-rust/6389 "2018-09-25T14:13:06Z")

</div>

Is there any documentation/example available to interface to rust? Like in ccall?

---

## [Trouble with calling include in julia C api. v0.7](https://discourse.julialang.org/t/trouble-with-calling-include-in-julia-c-api-v0-7/15466)

<div class="topic-metadata">

**Author:** [@mikeando](https://discourse.julialang.org/u/mikeando)\
**Replies:** 0\
**Last updated:** [September 25, 2018, 1:47pm UTC](https://discourse.julialang.org/t/trouble-with-calling-include-in-julia-c-api-v0-7/15466 "2018-09-25T13:47:20Z")

</div>

I’m having some trouble including a file from the C api (via Java - but hopefully that doesn’t matter) My code is: #include \<jni.h\> #include \<stdio.h\> #include \<julia.h\> void REPT() { if (jl\_exception\_occurred()) …

---

## [How to make a new testset type](https://discourse.julialang.org/t/how-to-make-a-new-testset-type/15463)

<div class="topic-metadata">

**Author:** [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Replies:** 2\
**Last updated:** [September 25, 2018, 12:58pm UTC](https://discourse.julialang.org/t/how-to-make-a-new-testset-type/15463 "2018-09-25T12:58:59Z")

</div>

I want to make a new testset type such that doing @testset MyTest "integer addition" begin @test 1 + 1 == 2 end inserts the statement println("- "^40) both before and after printing the results of the @test (those …

---

## [Summing arrays efficiently](https://discourse.julialang.org/t/summing-arrays-efficiently/15338)

<div class="topic-metadata">

**Author:** [@bennedich](https://discourse.julialang.org/u/bennedich)\
**Replies:** 9\
**Last updated:** [September 22, 2018, 2:20pm UTC](https://discourse.julialang.org/t/summing-arrays-efficiently/15338 "2018-09-22T14:20:44Z")

</div>

N = 1024 ^ 2; A = \[ones(N), ones(N), ones(N), ones(N)\]; The naive way of summing the arrays in A would be to do sum(A). However, note the performance: julia\> @btime sum(A); 7.968 ms (6 allocations: 24.00 MiB) It unn…

---

## [How to wrap a C++ class with a templated constructor](https://discourse.julialang.org/t/how-to-wrap-a-c-class-with-a-templated-constructor/15364)

<div class="topic-metadata">

**Author:** [@jstrube](https://discourse.julialang.org/u/jstrube)\
**Replies:** 5\
**Last updated:** [September 25, 2018, 6:06am UTC](https://discourse.julialang.org/t/how-to-wrap-a-c-class-with-a-templated-constructor/15364 "2018-09-25T06:06:29Z")

</div>

I’m trying to wrap the fastjet library in C++, using CxxWrap. I’ve been trying to figure out how to wrap a templated constructor for this class, but I’m failing. My attempt to just let the compiler figure this out is n…

---

## [Pmap slow compared to map](https://discourse.julialang.org/t/pmap-slow-compared-to-map/14691)

<div class="topic-metadata">

**Author:** [@Duls91](https://discourse.julialang.org/u/Duls91)\
**Replies:** 11\
**Last updated:** [September 25, 2018, 1:59am UTC](https://discourse.julialang.org/t/pmap-slow-compared-to-map/14691 "2018-09-25T01:59:49Z")

</div>

I am trying to write a parallel image cross-correlation algorithm and I am not sure why I do not get the performance with pmap as expected. So basically, I have two images (im1 and im2). I take smaller slices (21x21) of…

---

## [Help writing simple convolution algorithm](https://discourse.julialang.org/t/help-writing-simple-convolution-algorithm/15407)

<div class="topic-metadata">

**Author:** [@Nakul\_Tiruviluamala](https://discourse.julialang.org/u/Nakul_Tiruviluamala)\
**Replies:** 5\
**Last updated:** [September 25, 2018, 1:12am UTC](https://discourse.julialang.org/t/help-writing-simple-convolution-algorithm/15407 "2018-09-25T01:12:29Z")

</div>

Hello, I am trying to write a convolution algorithm for learning purposes. I haven’t gotten to the superposition stage yet. I am stuck on prepending 0 to each iteration of the array which I am attempting to do with unsh…

---

## [keys() potential bug?](https://discourse.julialang.org/t/keys-potential-bug/15424)

<div class="topic-metadata">

**Author:** [@alin314](https://discourse.julialang.org/u/alin314)\
**Replies:** 5\
**Last updated:** [September 24, 2018, 4:47pm UTC](https://discourse.julialang.org/t/keys-potential-bug/15424 "2018-09-24T16:47:46Z")

</div>

Running the following code: s = Dict(1=\>‘a’, 2=\>‘b’) for key in keys(s) println(key) s\[key+1\] = ‘x’ end generates the result: 2 3 1 Is this a bug? I expect the result to contain only keys 1 and 2. If I replace …

---

## [Markdown and line ending conventions](https://discourse.julialang.org/t/markdown-and-line-ending-conventions/15419)

<div class="topic-metadata">

**Author:** [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Replies:** 2\
**Last updated:** [September 24, 2018, 2:52pm UTC](https://discourse.julialang.org/t/markdown-and-line-ending-conventions/15419 "2018-09-24T14:52:57Z")

</div>

I’m getting different results when parsing markdown on Linux and Windows because the latter checks out the the markdown file with native Windows line endings. E.g. julia\> Markdown.parse("\* a\\n\\n \* b\\n") == Markdown.par…

---

## [Immutable composite type?](https://discourse.julialang.org/t/immutable-composite-type/15406)

<div class="topic-metadata">

**Author:** [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Replies:** 19\
**Last updated:** [September 24, 2018, 2:00pm UTC](https://discourse.julialang.org/t/immutable-composite-type/15406 "2018-09-24T14:00:44Z")

</div>

I have a composite type with many fields. The instance of it is essentially unchanged after initialization. So it could be declared as a immutable struct. But since it has many fields, I currently declared it as a mut…

---

## [How have other v0.6 users dealt with all the broken Plotting libraries?](https://discourse.julialang.org/t/how-have-other-v0-6-users-dealt-with-all-the-broken-plotting-libraries/15403)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 9\
**Last updated:** [September 24, 2018, 12:41pm UTC](https://discourse.julialang.org/t/how-have-other-v0-6-users-dealt-with-all-the-broken-plotting-libraries/15403 "2018-09-24T12:41:21Z")

</div>

It seems like: GR makes tiny plots PyPlot makes grainy plots PlotlyJS doesn’t work at all (for v0.6) PGFPlots takes a minute to make a single plot I just want to plot something and don’t have time to port an ent…

[Previous page](https://discourse.julialang.org/c/usage/6.md?page=934)

[Next page](https://discourse.julialang.org/c/usage/6.md?page=936)
