# General Usage

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

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

**Page:** 811

---

## [Inconsistent errors when creating compact style functions/lambdas with type parameters and return types](https://discourse.julialang.org/t/inconsistent-errors-when-creating-compact-style-functions-lambdas-with-type-parameters-and-return-types/31540)

<div class="topic-metadata">

**Author:** [@dataDiver](https://discourse.julialang.org/u/dataDiver)\
**Replies:** 1\
**Last updated:** [November 26, 2019, 6:36pm UTC](https://discourse.julialang.org/t/inconsistent-errors-when-creating-compact-style-functions-lambdas-with-type-parameters-and-return-types/31540 "2019-11-26T18:36:06Z")

</div>

I sometimes use the return type feature in Julia, and I have noticed that it is only properly available in the full function style: For instance I can define: function test(x::T, x::T)::T where {T} return x\*exp(y) en…

---

## [Repeated @benchmark causes RAM creep](https://discourse.julialang.org/t/repeated-benchmark-causes-ram-creep/31533)

<div class="topic-metadata">

**Author:** [@Crown421](https://discourse.julialang.org/u/Crown421)\
**Replies:** 4\
**Last updated:** [November 26, 2019, 5:19pm UTC](https://discourse.julialang.org/t/repeated-benchmark-causes-ram-creep/31533 "2019-11-26T17:19:08Z")

</div>

I am currently trying to quantify the performance/ scaling of the VML functions as added via VML.jl, and ran into a curious problem. Running this script, my RAM steadily increases until julia consumes 12-14Gb at the en…

---

## [Why A\[:,1\] .= x allocates?](https://discourse.julialang.org/t/why-a-1-x-allocates/31534)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 1\
**Last updated:** [November 26, 2019, 4:18pm UTC](https://discourse.julialang.org/t/why-a-1-x-allocates/31534 "2019-11-26T16:18:28Z")

</div>

Why the following code allocates? function f(A,x) A\[:,1\] .= x; return nothing end julia\> A = randn(5,5); x = randn(5); julia\> @btime f($A, $x) 30.941 ns (1 allocation: 48 bytes)

---

## [Including CSV Files in a Package I'm Developing..?](https://discourse.julialang.org/t/including-csv-files-in-a-package-im-developing/31532)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 4\
**Last updated:** [November 26, 2019, 4:03pm UTC](https://discourse.julialang.org/t/including-csv-files-in-a-package-im-developing/31532 "2019-11-26T16:03:50Z")

</div>

I’m attempting to develop my first package and I have a question about how to incorporate some necessary data into the package. Right now, I have four .csv files that include some data/lookup values that will be necessar…

---

## [Threads.@threads and Threads.@spawn](https://discourse.julialang.org/t/threads-threads-and-threads-spawn/31502)

<div class="topic-metadata">

**Author:** [@dkiese](https://discourse.julialang.org/u/dkiese)\
**Replies:** 4\
**Last updated:** [November 26, 2019, 3:25pm UTC](https://discourse.julialang.org/t/threads-threads-and-threads-spawn/31502 "2019-11-26T15:25:41Z")

</div>

Hi everyone, I have a short question regarding the usage of the Threads.@spawn macro in combination with Threads.@threads. Say I have code which looks like some\_task = Threads.@spawn begin some\_function\_call\_1…

---

## [Undo add and instead dev my local package](https://discourse.julialang.org/t/undo-add-and-instead-dev-my-local-package/31510)

<div class="topic-metadata">

**Author:** [@doomphoenix-qxz](https://discourse.julialang.org/u/doomphoenix-qxz)\
**Replies:** 3\
**Last updated:** [November 26, 2019, 3:14pm UTC](https://discourse.julialang.org/t/undo-add-and-instead-dev-my-local-package/31510 "2019-11-26T15:14:16Z")

</div>

I created a package using PkgTemplates. I put it in .julia/dev and then added it to my primary environment for development purposes. Now when I change and git commit the files, it’s still pulling old commits that aren’t…

---

## [Generic types in parametric struct constructor](https://discourse.julialang.org/t/generic-types-in-parametric-struct-constructor/31530)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 2\
**Last updated:** [November 26, 2019, 2:01pm UTC](https://discourse.julialang.org/t/generic-types-in-parametric-struct-constructor/31530 "2019-11-26T14:01:46Z")

</div>

Why does this not work ? using Distributions Uniform{Float32}(0.0,1.0) ERROR: MethodError: no method matching Uniform{Float32}(::Float64, ::Float64) Closest candidates are: Uniform{Float32}(::T\<:Real, ::T\<:Real) where…

---

## [Can I capture sympy output in weave document?](https://discourse.julialang.org/t/can-i-capture-sympy-output-in-weave-document/23633)

<div class="topic-metadata">

**Author:** [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Replies:** 2\
**Last updated:** [November 26, 2019, 1:25pm UTC](https://discourse.julialang.org/t/can-i-capture-sympy-output-in-weave-document/23633 "2019-11-26T13:25:35Z")

</div>

I’m interested if I can render SymPy.jl-s output with Weave just like in jupyter notebooks? I know I can weave into tex and process further, but would be easier (at least for me) if the output could directly captured in …

---

## [K-Means with penalty on (weighted) cluster size](https://discourse.julialang.org/t/k-means-with-penalty-on-weighted-cluster-size/31494)

<div class="topic-metadata">

**Author:** [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Replies:** 4\
**Last updated:** [November 26, 2019, 10:43am UTC](https://discourse.julialang.org/t/k-means-with-penalty-on-weighted-cluster-size/31494 "2019-11-26T10:43:01Z")

</div>

As the title suggests, I’m trying to cluster a set of points in space into a given number of clusters based on their proximity, however I also want the clusters to be of roughly equal size based on the “weight” of each l…

---

## [Vectorize replace with Vector of String raises DimensionMismatch](https://discourse.julialang.org/t/vectorize-replace-with-vector-of-string-raises-dimensionmismatch/31521)

<div class="topic-metadata">

**Author:** [@scelles](https://discourse.julialang.org/u/scelles)\
**Replies:** 1\
**Last updated:** [November 26, 2019, 9:37am UTC](https://discourse.julialang.org/t/vectorize-replace-with-vector-of-string-raises-dimensionmismatch/31521 "2019-11-26T09:37:10Z")

</div>

Hello, I’m trying to replace coma with point in the following Vector of String julia\> a = \["0,309042 46,586349 111,4", "0,309042 46,586349 111,1", "0,309042 46,586349 111,3"\] 3-element Array{String,1}: "0,309042 46,58…

---

## [Local package development methodology discussion](https://discourse.julialang.org/t/local-package-development-methodology-discussion/31515)

<div class="topic-metadata">

**Author:** [@Glen](https://discourse.julialang.org/u/Glen)\
**Replies:** 1\
**Last updated:** [November 26, 2019, 7:05am UTC](https://discourse.julialang.org/t/local-package-development-methodology-discussion/31515 "2019-11-26T07:05:57Z")

</div>

Hi, I’ve been using Julia for a while and developed the habit of setting LOAD\_PATH in the Julia start-up file so that I have a directory structure like: ~/julia/dev-0.4/\*packages\* ~/julia/dev-0.5/\*packages\* ~/julia/dev…

---

## [Working with Weave.jl and jmd files](https://discourse.julialang.org/t/working-with-weave-jl-and-jmd-files/31514)

<div class="topic-metadata">

**Author:** [@Raf](https://discourse.julialang.org/u/Raf)\
**Replies:** 4\
**Last updated:** [November 26, 2019, 5:05am UTC](https://discourse.julialang.org/t/working-with-weave-jl-and-jmd-files/31514 "2019-11-26T05:05:01Z")

</div>

I’m putting together .jmd examples for a few packages- to build pdfs, jupyter notebooks and package documentation. Does anyone have a good workflow for working with jmd? In both vim and Atom I struggle to actually use a…

---

## [Adjust solution obtained from DifferentialEquations.jl](https://discourse.julialang.org/t/adjust-solution-obtained-from-differentialequations-jl/31452)

<div class="topic-metadata">

**Author:** [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Replies:** 4\
**Last updated:** [November 25, 2019, 10:39pm UTC](https://discourse.julialang.org/t/adjust-solution-obtained-from-differentialequations-jl/31452 "2019-11-25T22:39:30Z")

</div>

Hello, I am using DifferentialEquations.jl to solve these ordinary differential equations: where dN/dt is bacteria susceptible, dI/dt is bacteria infected and dV/dt is phages. I wrote the following code: function dy…

---

## [Am I reaching limits of multiple dispatch?](https://discourse.julialang.org/t/am-i-reaching-limits-of-multiple-dispatch/31479)

<div class="topic-metadata">

**Author:** [@Janis\_Erdmanis](https://discourse.julialang.org/u/Janis_Erdmanis)\
**Replies:** 2\
**Last updated:** [November 25, 2019, 7:54pm UTC](https://discourse.julialang.org/t/am-i-reaching-limits-of-multiple-dispatch/31479 "2019-11-25T19:54:53Z")

</div>

Recently I implemented some basic cryptographic protocols. One of them is Diffie-Hellman key exchange protocol where only necessity is that the communication channel implements serialize and deserialize methods. Initiall…

---

## [Set environmental variable for BLAST analysis via Julia](https://discourse.julialang.org/t/set-environmental-variable-for-blast-analysis-via-julia/31498)

<div class="topic-metadata">

**Author:** [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Replies:** 0\
**Last updated:** [November 25, 2019, 3:13pm UTC](https://discourse.julialang.org/t/set-environmental-variable-for-blast-analysis-via-julia/31498 "2019-11-25T15:13:11Z")

</div>

Hello I am using a shell command called blastx to find some organism’s names from a sequencing experiment. This program requires the definition of an environmental variable BLASTDB pointing to a specific directory insid…

---

## [Create a Package](https://discourse.julialang.org/t/create-a-package/20280)

<div class="topic-metadata">

**Author:** [@marouane](https://discourse.julialang.org/u/marouane)\
**Replies:** 25\
**Last updated:** [November 25, 2019, 1:37pm UTC](https://discourse.julialang.org/t/create-a-package/20280 "2019-11-25T13:37:44Z")

</div>

Hello Julia Community, i have a question what if i want to create a Package on Julia 0.7 is it possible and if it’s yes how can i do that ?

---

## [How to define a function negation?](https://discourse.julialang.org/t/how-to-define-a-function-negation/31483)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 4\
**Last updated:** [November 25, 2019, 11:55am UTC](https://discourse.julialang.org/t/how-to-define-a-function-negation/31483 "2019-11-25T11:55:41Z")

</div>

For example, julia\> f(::Int) = \[1, 1\] f (generic function with 1 method) Now I want to define the negation function of f: julia\> (!f)(::Int) = 2 ERROR: syntax: invalid function name "!(f)" Stacktrace: \[1\] top-level s…

---

## [\`using AMQPClient\` significantly slows down code](https://discourse.julialang.org/t/using-amqpclient-significantly-slows-down-code/31228)

<div class="topic-metadata">

**Author:** [@Marek\_Kukan](https://discourse.julialang.org/u/Marek_Kukan)\
**Replies:** 4\
**Last updated:** [November 25, 2019, 10:05am UTC](https://discourse.julialang.org/t/using-amqpclient-significantly-slows-down-code/31228 "2019-11-25T10:05:52Z")

</div>

Hello, I came across this weird performance issue, can someone please explain why using AMQPClient causes ~100x performance drop? julia\> m = Matrix{Any}(rand(1000,1000)); julia\> function f(m, n) for i in 1:…

---

## [A transparent way for a decorator pattern (maybe without SimpleTraits)](https://discourse.julialang.org/t/a-transparent-way-for-a-decorator-pattern-maybe-without-simpletraits/31446)

<div class="topic-metadata">

**Author:** [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Replies:** 4\
**Last updated:** [November 25, 2019, 9:27am UTC](https://discourse.julialang.org/t/a-transparent-way-for-a-decorator-pattern-maybe-without-simpletraits/31446 "2019-11-25T09:27:43Z")

</div>

Let’s say I have a type A a user should easily be able to extend by subtypes and write functions f, g, … and so on for. These functions are quite a few let’s say 20. Furthermore a decorator pattern that decorates A addi…

---

## [JLD file , how to add new line to existing array in jld file?](https://discourse.julialang.org/t/jld-file-how-to-add-new-line-to-existing-array-in-jld-file/31447)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 3\
**Last updated:** [November 24, 2019, 3:07pm UTC](https://discourse.julialang.org/t/jld-file-how-to-add-new-line-to-existing-array-in-jld-file/31447 "2019-11-24T15:07:49Z")

</div>

Ho to add new data to existingg Array in jld file julia\> f=jldopen("file.jld","w") julia\> close(f) julia\> f=jldopen("file.jld","r+") julia\> write(f,"A",rand(5,5)) julia\> read(f,"A") 5×5 Array{Float64,2}: 0.626607 0.14…

---

## [TraitWrapper - an idea for developing a traits based system](https://discourse.julialang.org/t/traitwrapper-an-idea-for-developing-a-traits-based-system/31179)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 9\
**Last updated:** [November 25, 2019, 4:57am UTC](https://discourse.julialang.org/t/traitwrapper-an-idea-for-developing-a-traits-based-system/31179 "2019-11-25T04:57:47Z")

</div>

I read with interests The Emergent Features of JuliaLang: Part II - Traits and have been thinking about traits lately. I think I understand how Holy Traits work but I feel unsatisfied with it. The examples and the blogs…

---

## ["CuArrays.CUDNN is unavailable", but it is installed](https://discourse.julialang.org/t/cuarrays-cudnn-is-unavailable-but-it-is-installed/31470)

<div class="topic-metadata">

**Author:** [@jchen975](https://discourse.julialang.org/u/jchen975)\
**Replies:** 0\
**Last updated:** [November 25, 2019, 3:23am UTC](https://discourse.julialang.org/t/cuarrays-cudnn-is-unavailable-but-it-is-installed/31470 "2019-11-25T03:23:57Z")

</div>

Hi, I’m using Julia 1.2.0 with the following packages installed: (v1.2) pkg\> st Status \`~/.julia/environments/v1.2/Project.toml\` \[fbb218c0\] BSON v0.2.4 \[3895d2a7\] CUDAapi v1.2.0 \[c5f51814\] CUDAdrv v3.1.0 \[be…

---

## [Convert method interferes with custom array colon broadcasting](https://discourse.julialang.org/t/convert-method-interferes-with-custom-array-colon-broadcasting/31468)

<div class="topic-metadata">

**Author:** [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Replies:** 0\
**Last updated:** [November 25, 2019, 2:10am UTC](https://discourse.julialang.org/t/convert-method-interferes-with-custom-array-colon-broadcasting/31468 "2019-11-25T02:10:53Z")

</div>

I have defined a custom Vector type which appears to work as required. struct MyVector{T} \<: AbstractVector{T} data::Vector{T} end Base.size(A::MyVector) = size(A.data) Base.IndexStyle(::Type{T}) where {T\<:MyVector…

---

## [Getting the CartesianIndex of specifi array elements](https://discourse.julialang.org/t/getting-the-cartesianindex-of-specifi-array-elements/31456)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 1\
**Last updated:** [November 24, 2019, 11:24pm UTC](https://discourse.julialang.org/t/getting-the-cartesianindex-of-specifi-array-elements/31456 "2019-11-24T23:24:34Z")

</div>

Dear all, I’m wondering if there is a simple way to get the CartesianIndex of speciic array elements. I’m not trying to build the whole list of CartesianIndices of an array, only of some of them. I’m asking because in …

---

## [\`maximum\` element across the 2nd dim of a matrix with \`missing\` values](https://discourse.julialang.org/t/maximum-element-across-the-2nd-dim-of-a-matrix-with-missing-values/31463)

<div class="topic-metadata">

**Author:** [@mroavi](https://discourse.julialang.org/u/mroavi)\
**Replies:** 2\
**Last updated:** [November 24, 2019, 9:16pm UTC](https://discourse.julialang.org/t/maximum-element-across-the-2nd-dim-of-a-matrix-with-missing-values/31463 "2019-11-24T21:16:31Z")

</div>

I am trying to find the maximum element across the 2nd dim of a matrix with missing values. This code unfortunatelly gives an error: A = \[1 missing 3; 4 5 missing; 7 8 9\] B = maximum(skipmissing(A), dims=2) ERROR: Loa…

---

## [Multivariate Normal Distribution](https://discourse.julialang.org/t/multivariate-normal-distribution/29973)

<div class="topic-metadata">

**Author:** [@Hugo\_RB](https://discourse.julialang.org/u/Hugo_RB)\
**Replies:** 17\
**Last updated:** [November 24, 2019, 8:27pm UTC](https://discourse.julialang.org/t/multivariate-normal-distribution/29973 "2019-11-24T20:27:02Z")

</div>

Hi there Could somebody give me a clear example about how to construct a MVND using the syntaxis given by the Distribution Pkg. I know that with Distributions.jl it is possible to generate a MVND just as it is possible t…

---

## [Converting docstrings into wiki documentation](https://discourse.julialang.org/t/converting-docstrings-into-wiki-documentation/31458)

<div class="topic-metadata">

**Author:** [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Replies:** 2\
**Last updated:** [November 24, 2019, 7:08pm UTC](https://discourse.julialang.org/t/converting-docstrings-into-wiki-documentation/31458 "2019-11-24T19:08:13Z")

</div>

Hi, I am in the process of finishing the testing for the new version of TSAnalysis.jl. I documented most functions and types via docstrings, and I was wondering whether there is a way to automatically convert docstrings…

---

## [Fully Removing Packages](https://discourse.julialang.org/t/fully-removing-packages/31161)

<div class="topic-metadata">

**Author:** [@Usor](https://discourse.julialang.org/u/Usor)\
**Replies:** 5\
**Last updated:** [November 24, 2019, 6:08pm UTC](https://discourse.julialang.org/t/fully-removing-packages/31161 "2019-11-24T18:08:28Z")

</div>

If you remove a package with the builtin package manager, are there any leftover files or directories that you could clean up manually? Any additional important information also appreciated.

---

## [Help with JSON2.jl](https://discourse.julialang.org/t/help-with-json2-jl/31433)

<div class="topic-metadata">

**Author:** [@cwiese](https://discourse.julialang.org/u/cwiese)\
**Replies:** 4\
**Last updated:** [November 24, 2019, 1:57pm UTC](https://discourse.julialang.org/t/help-with-json2-jl/31433 "2019-11-24T13:57:33Z")

</div>

What am I doing wrong here? I get ERROR: MethodError: no method matching nQ julia\> mutable struct Q name::String scens::Vector{String} nQ(name, scens) = n…

---

## [Setdiff with comparison function?](https://discourse.julialang.org/t/setdiff-with-comparison-function/31405)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 2\
**Last updated:** [November 24, 2019, 7:11am UTC](https://discourse.julialang.org/t/setdiff-with-comparison-function/31405 "2019-11-24T07:11:29Z")

</div>

I need to setdiff between 2 containers using a custom comparison function? Is there such a thing? Thanks

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

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