# General Usage

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

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

**Page:** 657

---

## [Documenting extended function from Base](https://discourse.julialang.org/t/documenting-extended-function-from-base/53432)

<div class="topic-metadata">

**Author:** [@mr.red](https://discourse.julialang.org/u/mr.red)\
**Replies:** 0\
**Last updated:** [January 16, 2021, 1:07pm UTC](https://discourse.julialang.org/t/documenting-extended-function-from-base/53432 "2021-01-16T13:07:46Z")

</div>

I am extending the Base.binomial which assumes two integer arguments to two complex arguments in SpecialFunctions. Now, I have problems documenting it. Currently it is implemented via """ binomial(x, y) Generalize…

---

## [Issue with parsing multiple items with "="](https://discourse.julialang.org/t/issue-with-parsing-multiple-items-with/53430)

<div class="topic-metadata">

**Author:** [@herm](https://discourse.julialang.org/u/herm)\
**Replies:** 2\
**Last updated:** [January 16, 2021, 12:47pm UTC](https://discourse.julialang.org/t/issue-with-parsing-multiple-items-with/53430 "2021-01-16T12:47:44Z")

</div>

There seems to be issue with the parsing of complex expressions with multiple items in the equal, the following code works for K=2:NZ1 for J=2:NY1 for I=2:NX1 HXS\[I,J,K\],HYS\[I,J,K\],HZS\[I,J,K\]= HXS\[I,J,K\]-sum(ygradke…

---

## [Scoping is too confusing with custom package and modules to use \`pmap\`](https://discourse.julialang.org/t/scoping-is-too-confusing-with-custom-package-and-modules-to-use-pmap/53383)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 3\
**Last updated:** [January 16, 2021, 12:37pm UTC](https://discourse.julialang.org/t/scoping-is-too-confusing-with-custom-package-and-modules-to-use-pmap/53383 "2021-01-16T12:37:18Z")

</div>

I saw the previous post about pmap. However, the answers do not work for me. Here’s my example. What am I missing? Note that MyPackage is generated by PkgTemplates. src/MyPackage.jl module MyPackage using Reexport…

---

## [Using parametric type inside outer parametric constructor](https://discourse.julialang.org/t/using-parametric-type-inside-outer-parametric-constructor/53388)

<div class="topic-metadata">

**Author:** [@schneiderfelipe](https://discourse.julialang.org/u/schneiderfelipe)\
**Replies:** 33\
**Last updated:** [January 16, 2021, 5:10am UTC](https://discourse.julialang.org/t/using-parametric-type-inside-outer-parametric-constructor/53388 "2021-01-16T05:10:34Z")

</div>

Hi, I can’t figure out how to use a parametric type inside a constructor. Namely, the following single commented line can’t be used: struct Foo{T\<:Real, S\<:AbstractMatrix{\<:T}} \<: AbstractArray{T, 4} data::S n::Int …

---

## [Pluto and Plotting Inside a For Loop](https://discourse.julialang.org/t/pluto-and-plotting-inside-a-for-loop/53424)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 3\
**Last updated:** [January 16, 2021, 4:33am UTC](https://discourse.julialang.org/t/pluto-and-plotting-inside-a-for-loop/53424 "2021-01-16T04:33:05Z")

</div>

Hello, I’ve generated an array of composite types (which I’ve I’ve defined). Each composite type has two fields called t and T which contain equally sized vectors. Each composite type saved in my array represents a diff…

---

## [Update the stable version docs with Documenter.jl](https://discourse.julialang.org/t/update-the-stable-version-docs-with-documenter-jl/51048)

<div class="topic-metadata">

**Author:** [@zachmatson](https://discourse.julialang.org/u/zachmatson)\
**Replies:** 4\
**Last updated:** [January 16, 2021, 4:22am UTC](https://discourse.julialang.org/t/update-the-stable-version-docs-with-documenter-jl/51048 "2021-01-16T04:22:23Z")

</div>

I want to change the documentation for the current version of my package and I have no code changes to release. Should I create a point release just for this? Or is there some way to edit the stable version of the Docume…

---

## [Error Building Package](https://discourse.julialang.org/t/error-building-package/53369)

<div class="topic-metadata">

**Author:** [@Ian\_Slagle](https://discourse.julialang.org/u/Ian_Slagle)\
**Replies:** 0\
**Last updated:** [January 15, 2021, 12:20am UTC](https://discourse.julialang.org/t/error-building-package/53369 "2021-01-15T00:20:39Z")

</div>

I am trying to install LRSLib.jl (from https://github.com/JuliaPolyhedra/LRSLib.jl) on my Debian machine (I mention because the library is not working with Windows). However, I seem to be running into an issue installin…

---

## [If parametric types are invariant, why is Vector{Int} a subtype of AbstractVector{Int}?](https://discourse.julialang.org/t/if-parametric-types-are-invariant-why-is-vector-int-a-subtype-of-abstractvector-int/53394)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 4\
**Last updated:** [January 15, 2021, 6:01pm UTC](https://discourse.julialang.org/t/if-parametric-types-are-invariant-why-is-vector-int-a-subtype-of-abstractvector-int/53394 "2021-01-15T18:01:49Z")

</div>

If parametric types are invariant, why is Vector{Int} a subtype of AbstractVector{Int}? julia\> Vector{Int} \<: AbstractVector{Int} true A somewhat more complete and self-contained example: julia\> abstract type Animal{T…

---

## [Moving from Travis to Github CI](https://discourse.julialang.org/t/moving-from-travis-to-github-ci/53361)

<div class="topic-metadata">

**Author:** [@goedman](https://discourse.julialang.org/u/goedman)\
**Replies:** 2\
**Last updated:** [January 15, 2021, 4:47pm UTC](https://discourse.julialang.org/t/moving-from-travis-to-github-ci/53361 "2021-01-15T16:47:49Z")

</div>

I’m trying to build Stan’s cmdstan binary while using Github CI. On Travis this is possible using: env: - JULIA\_CMDSTAN\_HOME="$HOME/cmdstan-2.24.0/" before\_install: - OLDWD=\`pwd\` - cd ~ - wget https://github.…

---

## [Macro to create variables from arrays of names and values](https://discourse.julialang.org/t/macro-to-create-variables-from-arrays-of-names-and-values/53349)

<div class="topic-metadata">

**Author:** [@thorek1](https://discourse.julialang.org/u/thorek1)\
**Replies:** 14\
**Last updated:** [January 15, 2021, 2:23pm UTC](https://discourse.julialang.org/t/macro-to-create-variables-from-arrays-of-names-and-values/53349 "2021-01-15T14:23:53Z")

</div>

Hi, I am stuck writing a macro to create variables from an array of names (as strings) and an array of values to be assigned. So this is what I start with: Names = \["R", "k", "y"\] Values = \[1.01, 4.7, 1.3\] what I wou…

---

## [Text Analysis. Does anybody know a package (Julia, Python) to parse a sentence to subject, verb, object.?](https://discourse.julialang.org/t/text-analysis-does-anybody-know-a-package-julia-python-to-parse-a-sentence-to-subject-verb-object/34834)

<div class="topic-metadata">

**Author:** [@BMval](https://discourse.julialang.org/u/BMval)\
**Replies:** 7\
**Last updated:** [January 15, 2021, 2:22pm UTC](https://discourse.julialang.org/t/text-analysis-does-anybody-know-a-package-julia-python-to-parse-a-sentence-to-subject-verb-object/34834 "2021-01-15T14:22:00Z")

</div>

Text Analysis: Does anybody know a package (Julia, Python) to parse a sentence to subject, verb, object? Thank you for any useful information. best

---

## [Understanding what -t does](https://discourse.julialang.org/t/understanding-what-t-does/53329)

<div class="topic-metadata">

**Author:** [@fa-bien](https://discourse.julialang.org/u/fa-bien)\
**Replies:** 18\
**Last updated:** [January 15, 2021, 11:43am UTC](https://discourse.julialang.org/t/understanding-what-t-does/53329 "2021-01-15T11:43:46Z")

</div>

I am running a single-threaded program and it executes ~10% faster when I run it with -t 2 compared to when I run with -t 1, i.e. when I allow two threads instead of one. The program does not explicitly refer to anything…

---

## [How to get persistence on distributed workers](https://discourse.julialang.org/t/how-to-get-persistence-on-distributed-workers/53098)

<div class="topic-metadata">

**Author:** [@mkarikom](https://discourse.julialang.org/u/mkarikom)\
**Replies:** 7\
**Last updated:** [January 14, 2021, 11:11pm UTC](https://discourse.julialang.org/t/how-to-get-persistence-on-distributed-workers/53098 "2021-01-14T23:11:28Z")

</div>

The following example attempts to define A on several workers, which then update their local copies. How can I make this work? using Distributed,Test addprocs(2) @everywhere function incA() A += myid() # this is th…

---

## [Faster updates in a priority queue](https://discourse.julialang.org/t/faster-updates-in-a-priority-queue/53346)

<div class="topic-metadata">

**Author:** [@shawnfrost](https://discourse.julialang.org/u/shawnfrost)\
**Replies:** 4\
**Last updated:** [January 14, 2021, 10:24pm UTC](https://discourse.julialang.org/t/faster-updates-in-a-priority-queue/53346 "2021-01-14T22:24:16Z")

</div>

Hi. I’m currently experiencing a bottleneck in my simulations where a relatively large amount of time is spent on the setindex! function from DataStructures.jl’s implementation of a priority queue. I have a representatio…

---

## [Problems build CodecZlib](https://discourse.julialang.org/t/problems-build-codeczlib/53332)

<div class="topic-metadata">

**Author:** [@AlexanderChen](https://discourse.julialang.org/u/AlexanderChen)\
**Replies:** 4\
**Last updated:** [January 14, 2021, 7:46pm UTC](https://discourse.julialang.org/t/problems-build-codeczlib/53332 "2021-01-14T19:46:50Z")

</div>

Hi, want to do some tests with MetaGraphs but it fails. error suggests to build CodecZlib. But get this error: (v1.0) pkg\> build CodecZlib Building CodecZlib → \`C:\\Users\\achen\\.julia\\packages\\CodecZlib\\5t9zO\\deps\\bui…

---

## [Minimum working example for ModelingToolkit's CTarget](https://discourse.julialang.org/t/minimum-working-example-for-modelingtoolkits-ctarget/53303)

<div class="topic-metadata">

**Author:** [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Replies:** 5\
**Last updated:** [January 14, 2021, 7:34pm UTC](https://discourse.julialang.org/t/minimum-working-example-for-modelingtoolkits-ctarget/53303 "2021-01-14T19:34:50Z")

</div>

I’m trying to use ModelingToolkit.build\_function to generate a C function with “vector-like” inputs, and “matrix-like” outputs. I would prefer not to have the left-hand-side of the equations in the state vector, but I ca…

---

## [How to improve the speed of matrix multiplication?](https://discourse.julialang.org/t/how-to-improve-the-speed-of-matrix-multiplication/53293)

<div class="topic-metadata">

**Author:** [@zxjroger](https://discourse.julialang.org/u/zxjroger)\
**Replies:** 10\
**Last updated:** [January 14, 2021, 4:34pm UTC](https://discourse.julialang.org/t/how-to-improve-the-speed-of-matrix-multiplication/53293 "2021-01-14T16:34:39Z")

</div>

I have a code about large matrix multiplication in a for loop which currently takes longer time than I expected. I wonder if it is possible to improve the following MWE code: temp1 = randn(1600, 1600) temp2 = randn(1600…

---

## [Improve performance for multiple For-loops](https://discourse.julialang.org/t/improve-performance-for-multiple-for-loops/53289)

<div class="topic-metadata">

**Author:** [@EuRoXy](https://discourse.julialang.org/u/EuRoXy)\
**Replies:** 19\
**Last updated:** [January 14, 2021, 4:09pm UTC](https://discourse.julialang.org/t/improve-performance-for-multiple-for-loops/53289 "2021-01-14T16:09:40Z")

</div>

I am trying to optimize a calculation of correlation on a geo-grid of size 16x16: using NetCDF function corr1vall(s, lon1, lat1) # scenario, longitude 1, latitude 1 pathPv = myPath \* "pv/" \* ssps\[s\] \* "/day/EU/regr/…

---

## [HPC simulations with DrWatson (continued from Slack)](https://discourse.julialang.org/t/hpc-simulations-with-drwatson-continued-from-slack/44171)

<div class="topic-metadata">

**Author:** [@sebastianpech](https://discourse.julialang.org/u/sebastianpech)\
**Replies:** 3\
**Last updated:** [January 14, 2021, 2:43pm UTC](https://discourse.julialang.org/t/hpc-simulations-with-drwatson-continued-from-slack/44171 "2021-01-14T14:43:36Z")

</div>

We can continue the discussion here so it doesn’t get lost in Slack. Slack messagesRachel Kurchin 31. Juli um 18:52 Uhr Hi all, I had DMed @Datseris about this and he suggested I post here; I guess some other package m…

---

## [Pmap results in Array of type Any](https://discourse.julialang.org/t/pmap-results-in-array-of-type-any/53307)

<div class="topic-metadata">

**Author:** [@threadedblue](https://discourse.julialang.org/u/threadedblue)\
**Replies:** 6\
**Last updated:** [January 14, 2021, 2:33pm UTC](https://discourse.julialang.org/t/pmap-results-in-array-of-type-any/53307 "2021-01-14T14:33:00Z")

</div>

All, New to Julia Distribution and I have a question about pmap usage particularly as to it’s return value. I have two functions I am calling with pmap. One is written to return a simple string value, the otherreturns …

---

## [@enter include("file.jl")](https://discourse.julialang.org/t/enter-include-file-jl/53335)

<div class="topic-metadata">

**Author:** [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Replies:** 0\
**Last updated:** [January 14, 2021, 1:14pm UTC](https://discourse.julialang.org/t/enter-include-file-jl/53335 "2021-01-14T13:14:06Z")

</div>

Can’t figure out how to get the VSCODE debugger to like: @enter include(“file.jl”) from the REPL When I step into the include, it goes into a ccall and doesn’t let me go into the file to hit a breakpoint. If I try to…

---

## [SparseArray types over distributed reduction](https://discourse.julialang.org/t/sparsearray-types-over-distributed-reduction/53116)

<div class="topic-metadata">

**Author:** [@tblz](https://discourse.julialang.org/u/tblz)\
**Replies:** 2\
**Last updated:** [January 14, 2021, 8:21am UTC](https://discourse.julialang.org/t/sparsearray-types-over-distributed-reduction/53116 "2021-01-14T08:21:44Z")

</div>

I have a use-case of large sparse arrays that can be built in parallel. A minimum working example similar to my code is: using Distributed @everywhere using SparseArrays @everywhere function build\_array() return spar…

---

## [Path to 1.6.0-beta x86-64 Linux opens to what it says is 1.0.4](https://discourse.julialang.org/t/path-to-1-6-0-beta-x86-64-linux-opens-to-what-it-says-is-1-0-4/53316)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 3\
**Last updated:** [January 14, 2021, 6:58am UTC](https://discourse.julialang.org/t/path-to-1-6-0-beta-x86-64-linux-opens-to-what-it-says-is-1-0-4/53316 "2021-01-14T06:58:34Z")

</div>

When I put in the path to the version of 1.6 beta, that I loaded, it says 1.0.4 in the opening screen. I’m not sure if that means it loaded 1.0.4, or if the title is wrong.

---

## [I want to write a better performance array, don't know if there is a ready-made one?](https://discourse.julialang.org/t/i-want-to-write-a-better-performance-array-dont-know-if-there-is-a-ready-made-one/53317)

<div class="topic-metadata">

**Author:** [@Zq\_F](https://discourse.julialang.org/u/Zq_F)\
**Replies:** 3\
**Last updated:** [January 14, 2021, 4:06am UTC](https://discourse.julialang.org/t/i-want-to-write-a-better-performance-array-dont-know-if-there-is-a-ready-made-one/53317 "2021-01-14T04:06:10Z")

</div>

I want to write a better performance array, don’t know if there is a ready-made one? I wrote a prototype struct Arr{T, N} \<: AbstractArray{T, N} ilength::Int64 data::Array{T, N} end Base.length(A::Arr) = A.ilength …

---

## [StatsBase.countmap for iterator not working? \`countmap(i for i in 1:10)\`](https://discourse.julialang.org/t/statsbase-countmap-for-iterator-not-working-countmap-i-for-i-in-1-10/53309)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 2\
**Last updated:** [January 13, 2021, 10:48pm UTC](https://discourse.julialang.org/t/statsbase-countmap-for-iterator-not-working-countmap-i-for-i-in-1-10/53309 "2021-01-13T22:48:39Z")

</div>

Hey community :smiley: julia\> using StatsBase julia\> countmap(i for i in 1:10) ERROR: MethodError: no method matching countmap(::Base.Generator{UnitRange{Int64},typeof(identity)}) Closest candidates are: countmap(::A…

---

## [Interpolating a Dict with Exprs inside a quoted expression](https://discourse.julialang.org/t/interpolating-a-dict-with-exprs-inside-a-quoted-expression/53265)

<div class="topic-metadata">

**Author:** [@MasFlam](https://discourse.julialang.org/u/MasFlam)\
**Replies:** 5\
**Last updated:** [January 13, 2021, 8:25pm UTC](https://discourse.julialang.org/t/interpolating-a-dict-with-exprs-inside-a-quoted-expression/53265 "2021-01-13T20:25:14Z")

</div>

I am coding some macros and in one of them I end up with a Dict{Symbol, Tuple{Symbol, Expr}}, where the Exprs are all supposed to be interpolated into the expression returned by the macro. What I am doing right now is th…

---

## [Excessive allocations when using Zygote.gradient](https://discourse.julialang.org/t/excessive-allocations-when-using-zygote-gradient/53296)

<div class="topic-metadata">

**Author:** [@MrRobot](https://discourse.julialang.org/u/MrRobot)\
**Replies:** 4\
**Last updated:** [January 13, 2021, 7:16pm UTC](https://discourse.julialang.org/t/excessive-allocations-when-using-zygote-gradient/53296 "2021-01-13T19:16:23Z")

</div>

I have as a MWE a lennard-Jones force calculation. I would like to define only energy functions, and then use automatic differentiation to calculate the derivative, and thus, force. However, for the LJ calculation, the …

---

## [DArray local part via global index range?](https://discourse.julialang.org/t/darray-local-part-via-global-index-range/53298)

<div class="topic-metadata">

**Author:** [@mkarikom](https://discourse.julialang.org/u/mkarikom)\
**Replies:** 0\
**Last updated:** [January 13, 2021, 6:22pm UTC](https://discourse.julialang.org/t/darray-local-part-via-global-index-range/53298 "2021-01-13T18:22:30Z")

</div>

I’d like to be able to get the local part via global indexing (without resorting to :L) in order to facilitate portability with SharedArrays. How can I fix the following: using Test,Distributed,DistributedArrays nwork…

---

## [Bottom-up in Pluto?](https://discourse.julialang.org/t/bottom-up-in-pluto/53182)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 8\
**Last updated:** [January 13, 2021, 4:21pm UTC](https://discourse.julialang.org/t/bottom-up-in-pluto/53182 "2021-01-13T16:21:51Z")

</div>

I just noticed that Pluto notebooks are built up bottom to top. Or, rather, the top is at the bottom, if saying it like this makes sense. I am hesitant to call this “wrong”, even though it did seem pretty strange to me.…

---

## [Calculation of Functions in a loop inside another Function](https://discourse.julialang.org/t/calculation-of-functions-in-a-loop-inside-another-function/53278)

<div class="topic-metadata">

**Author:** [@tgautam03](https://discourse.julialang.org/u/tgautam03)\
**Replies:** 5\
**Last updated:** [January 13, 2021, 4:21pm UTC](https://discourse.julialang.org/t/calculation-of-functions-in-a-loop-inside-another-function/53278 "2021-01-13T16:21:40Z")

</div>

Hi, I’m looking to calculate nested functions of form f(g(h(...k(x)...)) and have written a function that takes in two arguments. One is called chain which is the vector of Function defined in the order of their calcul…

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

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