# General Usage

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

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

**Page:** 423

---

## [Can someone please explain the \`lib\` directory?](https://discourse.julialang.org/t/can-someone-please-explain-the-lib-directory/84238)

<div class="topic-metadata">

**Author:** [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Replies:** 1\
**Last updated:** [July 14, 2022, 8:27pm UTC](https://discourse.julialang.org/t/can-someone-please-explain-the-lib-directory/84238 "2022-07-14T20:27:15Z")

</div>

I see a lib directory in GitHub - JuliaArrays/ArrayInterface.jl: Designs for new Base array interface primitives, used widely through scientific machine learning (SciML) and other organizations and GitHub - SciML/Optimiz…

---

## [DAMMmodel.jl Can't Work](https://discourse.julialang.org/t/dammmodel-jl-cant-work/84101)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 14\
**Last updated:** [July 15, 2022, 12:14am UTC](https://discourse.julialang.org/t/dammmodel-jl-cant-work/84101 "2022-07-15T00:14:39Z")

</div>

Hi all, I am trying this Julia package: https://github.com/CUPofTEAproject/DAMMmodel.jl After typing \`using DAMMmodel’, I get this error: UndefVarError: DAMMfdata not defined UndefVarError: DAMMviz not defined

---

## [PythonCall pip dependency not building correctly](https://discourse.julialang.org/t/pythoncall-pip-dependency-not-building-correctly/84237)

<div class="topic-metadata">

**Author:** [@AnushaSekar](https://discourse.julialang.org/u/AnushaSekar)\
**Replies:** 1\
**Last updated:** [July 14, 2022, 10:24pm UTC](https://discourse.julialang.org/t/pythoncall-pip-dependency-not-building-correctly/84237 "2022-07-14T22:24:32Z")

</div>

I have a python package, which I can pip install. I am trying to wrap it using PythonCall. My python package has a pyproject.toml file and it has scipy as one of its dependencies. The latest scipy seems to need a version…

---

## [PlotlyJS & savefig](https://discourse.julialang.org/t/plotlyjs-savefig/83637)

<div class="topic-metadata">

**Author:** [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Replies:** 4\
**Last updated:** [July 14, 2022, 8:59pm UTC](https://discourse.julialang.org/t/plotlyjs-savefig/83637 "2022-07-14T20:59:47Z")

</div>

I like the package PlotlyJS because of the good support of a secondary Y-axis. Unfortunatly, I discovered that the savefig() seems to be restricted in the number of points it can handle and I don’t know if this is a Pl…

---

## [Defining an array of symbolic variables causes error with NeuralPDE.discretize()](https://discourse.julialang.org/t/defining-an-array-of-symbolic-variables-causes-error-with-neuralpde-discretize/83842)

<div class="topic-metadata">

**Author:** [@hpieper14](https://discourse.julialang.org/u/hpieper14)\
**Replies:** 7\
**Last updated:** [July 14, 2022, 4:21pm UTC](https://discourse.julialang.org/t/defining-an-array-of-symbolic-variables-causes-error-with-neuralpde-discretize/83842 "2022-07-14T16:21:37Z")

</div>

I am trying to solve a PDE with variables \[t, z1, …, zn\] using NeuralPDE.jl. Here’s my code: using Test, Flux, Optim, DiffEqFlux, Optimization using Random, NeuralPDE, DifferentialEquations using Statistics, Distributio…

---

## [How can I do list comprehension for vcat?](https://discourse.julialang.org/t/how-can-i-do-list-comprehension-for-vcat/84178)

<div class="topic-metadata">

**Author:** [@Phuntsho](https://discourse.julialang.org/u/Phuntsho)\
**Replies:** 10\
**Last updated:** [July 14, 2022, 11:20am UTC](https://discourse.julialang.org/t/how-can-i-do-list-comprehension-for-vcat/84178 "2022-07-14T11:20:22Z")

</div>

I have many 1-d lists that I want to concatenate to have a 1-d list, probably in a list comprehension style. Following is how I can achieve using explicit for-loop f = \[\] a = \[1,2,3,4,6\] b = \[3,4,5,20\] c = \[8,4,5,20\] d …

---

## [(Efficiently) construct a Dictionary from a Set](https://discourse.julialang.org/t/efficiently-construct-a-dictionary-from-a-set/83896)

<div class="topic-metadata">

**Author:** [@April-Hannah-Lena](https://discourse.julialang.org/u/April-Hannah-Lena)\
**Replies:** 15\
**Last updated:** [July 14, 2022, 11:24am UTC](https://discourse.julialang.org/t/efficiently-construct-a-dictionary-from-a-set/83896 "2022-07-14T11:24:27Z")

</div>

In our package we have some data structures that act as wrappers around Set{Int} to keep track of various index sets. We now want to insert a ‘weight’ for each item in the set, ie construct a Dict{Int,Float64}, and we wa…

---

## [Help with defining macros](https://discourse.julialang.org/t/help-with-defining-macros/84206)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 4\
**Last updated:** [July 14, 2022, 7:07am UTC](https://discourse.julialang.org/t/help-with-defining-macros/84206 "2022-07-14T07:07:34Z")

</div>

I have a struct as follows: @kwdef struct Node index value optional\_attribute = 0.0 end @kwdef struct Network nodes::Vector{node} = Node\[\] end Now, I can define a Network object and assign nodes to it.…

---

## [Efficient global parameters](https://discourse.julialang.org/t/efficient-global-parameters/84090)

<div class="topic-metadata">

**Author:** [@Nathaniel](https://discourse.julialang.org/u/Nathaniel)\
**Replies:** 12\
**Last updated:** [July 14, 2022, 7:01am UTC](https://discourse.julialang.org/t/efficient-global-parameters/84090 "2022-07-14T07:01:18Z")

</div>

I’m getting back into Julia after a long time not using it, so this is a fairly basic question. I have a cell in my notebook something like this: parameters = \[ \[1.0, 2,0\], \[3.0, 4.0\], \[5.0, 6.0\], \[7.0, 8.0…

---

## [How to get vector of tuples from the vector of tuples using certain conditions?](https://discourse.julialang.org/t/how-to-get-vector-of-tuples-from-the-vector-of-tuples-using-certain-conditions/84205)

<div class="topic-metadata">

**Author:** [@Phuntsho](https://discourse.julialang.org/u/Phuntsho)\
**Replies:** 2\
**Last updated:** [July 14, 2022, 4:42am UTC](https://discourse.julialang.org/t/how-to-get-vector-of-tuples-from-the-vector-of-tuples-using-certain-conditions/84205 "2022-07-14T04:42:35Z")

</div>

I have a vector containing tuples and I want to extract some tuples that meet certain conditions. I tried something as shown below but didn’t get the expected result. A = \[(1,2),(3,2),(3,4),(5,4),(3,2)\] A\_c = findall(x-\>…

---

## [Does Julia use original PCRE or PCRE2?](https://discourse.julialang.org/t/does-julia-use-original-pcre-or-pcre2/84203)

<div class="topic-metadata">

**Author:** [@ProvocaTeach](https://discourse.julialang.org/u/ProvocaTeach)\
**Replies:** 1\
**Last updated:** [July 14, 2022, 2:36am UTC](https://discourse.julialang.org/t/does-julia-use-original-pcre-or-pcre2/84203 "2022-07-14T02:36:09Z")

</div>

Does Julia 1.7.3 use the original Perl-compatible regular expressions (PCRE) or the second version (PCRE2)? The Julia docs on regexes say Julia uses PCRE, but they link to the PCRE2 spec while making no mention of the v…

---

## [Improving the performance of a sum over a vector of vectors](https://discourse.julialang.org/t/improving-the-performance-of-a-sum-over-a-vector-of-vectors/84150)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 10\
**Last updated:** [July 13, 2022, 10:36pm UTC](https://discourse.julialang.org/t/improving-the-performance-of-a-sum-over-a-vector-of-vectors/84150 "2022-07-13T22:36:19Z")

</div>

I want to consider the sum over a vector of vectors. Consider the following benchmarks for a problem involving the sum over some data (getting a log-likelihood): using BenchmarkTools, Random, LoopVectorization Random.se…

---

## [How to write nested reducibles in Transducers.jl](https://discourse.julialang.org/t/how-to-write-nested-reducibles-in-transducers-jl/84199)

<div class="topic-metadata">

**Author:** [@nielsls](https://discourse.julialang.org/u/nielsls)\
**Replies:** 0\
**Last updated:** [July 13, 2022, 9:44pm UTC](https://discourse.julialang.org/t/how-to-write-nested-reducibles-in-transducers-jl/84199 "2022-07-13T21:44:32Z")

</div>

Writing reducibles · Transducers.jl describes how to make a non-iterable collection reducible; e.g. how to use it as input to transducers. But it does not describe how to delegate the reducing operation to another reduci…

---

## [How do dynamic text content with Makie and record?](https://discourse.julialang.org/t/how-do-dynamic-text-content-with-makie-and-record/84141)

<div class="topic-metadata">

**Author:** [@evandro.schulz](https://discourse.julialang.org/u/evandro.schulz)\
**Replies:** 2\
**Last updated:** [July 13, 2022, 6:17pm UTC](https://discourse.julialang.org/t/how-do-dynamic-text-content-with-makie-and-record/84141 "2022-07-13T18:17:45Z")

</div>

I’d want to create a animation of a plot that show the changing in the values in the time. Changing the plot charts, ok. But, I want to chance a text content and the scale of x and y axes per i. How I do it? I cannot ind…

---

## [Fast Jaccard Distance between sets of strings?](https://discourse.julialang.org/t/fast-jaccard-distance-between-sets-of-strings/84125)

<div class="topic-metadata">

**Author:** [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Replies:** 3\
**Last updated:** [July 13, 2022, 5:11pm UTC](https://discourse.julialang.org/t/fast-jaccard-distance-between-sets-of-strings/84125 "2022-07-13T17:11:33Z")

</div>

My friend needs to compute the jaccard distance between sets of strings. The number of sets is hundreds and the number of strings in each set is thousands. The length of the strings is \<= 20. He has thousands of dataset…

---

## [Windows not searching contents of \*.jl files](https://discourse.julialang.org/t/windows-not-searching-contents-of-jl-files/84123)

<div class="topic-metadata">

**Author:** [@thompsonmj](https://discourse.julialang.org/u/thompsonmj)\
**Replies:** 5\
**Last updated:** [July 13, 2022, 3:40pm UTC](https://discourse.julialang.org/t/windows-not-searching-contents-of-jl-files/84123 "2022-07-13T15:40:56Z")

</div>

Not sure if this is a Windows issue or what can be done, but I am using Windows Explorer to search for some old code. It isn’t searching the contents of my \*.jl files, but is returning results for contents of other file …

---

## [Return duplicate rows in array with no of times and index of first occurence](https://discourse.julialang.org/t/return-duplicate-rows-in-array-with-no-of-times-and-index-of-first-occurence/84176)

<div class="topic-metadata">

**Author:** [@ayodyas](https://discourse.julialang.org/u/ayodyas)\
**Replies:** 6\
**Last updated:** [July 13, 2022, 3:25pm UTC](https://discourse.julialang.org/t/return-duplicate-rows-in-array-with-no-of-times-and-index-of-first-occurence/84176 "2022-07-13T15:25:09Z")

</div>

I have a matrix A=\[1,2; 2,3; 3,4;1,2\], I wanted to return duplicated rows (here 1,2), no of repetitions (here 1) and the row index of the first occurrence (here 1st row) I have tried many thing with unique, but nothing…

---

## [Using DynamicalSystems: InexactError](https://discourse.julialang.org/t/using-dynamicalsystems-inexacterror/83965)

<div class="topic-metadata">

**Author:** [@Griffith\_Mendonca](https://discourse.julialang.org/u/Griffith_Mendonca)\
**Replies:** 2\
**Last updated:** [July 13, 2022, 2:44pm UTC](https://discourse.julialang.org/t/using-dynamicalsystems-inexacterror/83965 "2022-07-13T14:44:38Z")

</div>

Dear all, I have a question about the meaning of some output messages from the package DynamicalSystems from https://juliadynamics.github.io/DynamicalSystems.jl/latest/chaos/lyapunovs/. This error message appears when I…

---

## [Println and ProgressMeter in the same loop](https://discourse.julialang.org/t/println-and-progressmeter-in-the-same-loop/32140)

<div class="topic-metadata">

**Author:** [@benzwick](https://discourse.julialang.org/u/benzwick)\
**Replies:** 6\
**Last updated:** [July 13, 2022, 2:14pm UTC](https://discourse.julialang.org/t/println-and-progressmeter-in-the-same-loop/32140 "2022-07-13T14:14:16Z")

</div>

I am trying to combine println (or @info for logging) and a ProgressMeter progress bar in a loop like this: using ProgressMeter prog = Progress(10) for i in 1:10 println("value: ", i^2) sleep(0.1) next!(prog…

---

## [Using BootStrap package to obtain the distribution of mean/sd](https://discourse.julialang.org/t/using-bootstrap-package-to-obtain-the-distribution-of-mean-sd/84164)

<div class="topic-metadata">

**Author:** [@AnshPatel7](https://discourse.julialang.org/u/AnshPatel7)\
**Replies:** 2\
**Last updated:** [July 13, 2022, 1:57pm UTC](https://discourse.julialang.org/t/using-bootstrap-package-to-obtain-the-distribution-of-mean-sd/84164 "2022-07-13T13:57:30Z")

</div>

Hi, I’m trying to use the bootstrap function to find the mean and sd of a dataset that I have generated. As an example, the following code gives me the mean, error and bias: A = randn(10) m = bootstrap(mean,A, BasicSa…

---

## [Performance of value assignment inside functions](https://discourse.julialang.org/t/performance-of-value-assignment-inside-functions/84162)

<div class="topic-metadata">

**Author:** [@NicolasW](https://discourse.julialang.org/u/NicolasW)\
**Replies:** 3\
**Last updated:** [July 13, 2022, 1:20pm UTC](https://discourse.julialang.org/t/performance-of-value-assignment-inside-functions/84162 "2022-07-13T13:20:55Z")

</div>

I am puzzled by the performance of Julia, somehow it matters if I fully specialize the function argument. Consider the two functions: @noinline @inbounds function update\_gen!(y::AbstractVector{T}, x::AbstractVector{T})…

---

## [Struct and vectorised function](https://discourse.julialang.org/t/struct-and-vectorised-function/84159)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 2\
**Last updated:** [July 13, 2022, 12:51pm UTC](https://discourse.julialang.org/t/struct-and-vectorised-function/84159 "2022-07-13T12:51:21Z")

</div>

struct X; x end struct Y; y end f(::X,::Y) = 1 f.( \[X(1),X(1)\], Y(1) ) This gives an error no method matching length(::Y) Is there a way to tell it that the “.” vectorisation of f() is over the vector of X, …

---

## [Create New Package in Julia: Why the test is fail?](https://discourse.julialang.org/t/create-new-package-in-julia-why-the-test-is-fail/84166)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 2\
**Last updated:** [July 13, 2022, 12:43pm UTC](https://discourse.julialang.org/t/create-new-package-in-julia-why-the-test-is-fail/84166 "2022-07-13T12:43:14Z")

</div>

Hi all, I follow https://julialang.org/contribute/developing\_package/ but when I test the package, it fails, it just the beginning of Hello World, not even complicated. Why is it fails?

---

## [Request for comments on gmsh documentation](https://discourse.julialang.org/t/request-for-comments-on-gmsh-documentation/84165)

<div class="topic-metadata">

**Author:** [@gwlagerweij](https://discourse.julialang.org/u/gwlagerweij)\
**Replies:** 0\
**Last updated:** [July 13, 2022, 11:44am UTC](https://discourse.julialang.org/t/request-for-comments-on-gmsh-documentation/84165 "2022-07-13T11:44:43Z")

</div>

Hi all, I have written a small introduction and guide to using gmsh in combination with Julia. This documentation is meant for students of a master-level course on the finite element method for electrical engineers (fur…

---

## [Can not use python package although conda status correct](https://discourse.julialang.org/t/can-not-use-python-package-although-conda-status-correct/84155)

<div class="topic-metadata">

**Author:** [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Replies:** 2\
**Last updated:** [July 13, 2022, 11:32am UTC](https://discourse.julialang.org/t/can-not-use-python-package-although-conda-status-correct/84155 "2022-07-13T11:32:58Z")

</div>

Hello I am using PythonCall and I want to use library simpleitk, (in pure python it always works it is well established package) I added it to Conda.toml all installs but I am unable to load it using pyimport, any help w…

---

## [GLFW' GLMakie error](https://discourse.julialang.org/t/glfw-glmakie-error/84153)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 0\
**Last updated:** [July 13, 2022, 8:30am UTC](https://discourse.julialang.org/t/glfw-glmakie-error/84153 "2022-07-13T08:30:59Z")

</div>

Hi all, Ï am using an OS that has no internet. Ï try to use a package, an error occurs: GLFW error API\_UNAVAILABLE ï can run OpenGL example fine

---

## [Composite image of multiple channels](https://discourse.julialang.org/t/composite-image-of-multiple-channels/84066)

<div class="topic-metadata">

**Author:** [@thompsonmj](https://discourse.julialang.org/u/thompsonmj)\
**Replies:** 12\
**Last updated:** [July 13, 2022, 7:39am UTC](https://discourse.julialang.org/t/composite-image-of-multiple-channels/84066 "2022-07-13T07:39:02Z")

</div>

I have 3 images, each a separate channel of the same sample. c1 = rand(100,100) c2 = rand(100,100) c3 = rand(100,100) I’d like to make a custom color gradient for each channel: using Plots pal = palette(:batlow,3) gra…

---

## [A julia function to stack two arrays of size (m, n), to get one of size (2, m, n)](https://discourse.julialang.org/t/a-julia-function-to-stack-two-arrays-of-size-m-n-to-get-one-of-size-2-m-n/49520)

<div class="topic-metadata">

**Author:** [@empet](https://discourse.julialang.org/u/empet)\
**Replies:** 22\
**Last updated:** [July 13, 2022, 6:40am UTC](https://discourse.julialang.org/t/a-julia-function-to-stack-two-arrays-of-size-m-n-to-get-one-of-size-2-m-n/49520 "2022-07-13T06:40:40Z")

</div>

I want to stack two arrays of size (m, n) to get an array of size (2, m, n), respectively (m, n, 2). With numpy.stack, np.stack((x,y)) returns an array of size (2, m, n) while np.stack((x,y), axis=-1)- an array of …

---

## [Using Turing for MCMC estimation](https://discourse.julialang.org/t/using-turing-for-mcmc-estimation/84137)

<div class="topic-metadata">

**Author:** [@Jian\_ZUO](https://discourse.julialang.org/u/Jian_ZUO)\
**Replies:** 4\
**Last updated:** [July 13, 2022, 6:30am UTC](https://discourse.julialang.org/t/using-turing-for-mcmc-estimation/84137 "2022-07-13T06:30:38Z")

</div>

Hi, I am new to Turing PPL. I have a random variable X which is Gamma distributed, i.e., X ~Ga(α, β). And the scale β parameter of X is also obeys a Gamma law, namely, β ~ Ga(α0, β0). Then I want to infer the above par…

---

## [How to write idiomatic (non-OOP) Julia version of OOP design pattern?](https://discourse.julialang.org/t/how-to-write-idiomatic-non-oop-julia-version-of-oop-design-pattern/83548)

<div class="topic-metadata">

**Author:** [@merlin](https://discourse.julialang.org/u/merlin)\
**Replies:** 8\
**Last updated:** [July 13, 2022, 5:30am UTC](https://discourse.julialang.org/t/how-to-write-idiomatic-non-oop-julia-version-of-oop-design-pattern/83548 "2022-07-13T05:30:41Z")

</div>

I learned a lot about Object Oriented Programming from this blog article from 2020 about “Gang of Four” design patterns. I should say that I learned about OOP long ago via a Java book but as a data professional I have ne…

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

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