# General Usage

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

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

**Page:** 344

---

## [How is the type of a heterogeneous vector determined when splatting and doing list comprehension?](https://discourse.julialang.org/t/how-is-the-type-of-a-heterogeneous-vector-determined-when-splatting-and-doing-list-comprehension/92572)

<div class="topic-metadata">

**Author:** [@arnelg](https://discourse.julialang.org/u/arnelg)\
**Replies:** 9\
**Last updated:** [January 15, 2023, 1:48am UTC](https://discourse.julialang.org/t/how-is-the-type-of-a-heterogeneous-vector-determined-when-splatting-and-doing-list-comprehension/92572 "2023-01-15T01:48:09Z")

</div>

Consider the type of the resulting Vector in these three cases: \[1, 1.0\] # case 1: Vector{Float64}, elements are promoted v = Any\[1, 1.0\] \[v...\] # case 2: gives identical result to case 1 \[x for x in v\] # case 3: Vec…

---

## [How to "reduce" an array?](https://discourse.julialang.org/t/how-to-reduce-an-array/92945)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 19\
**Last updated:** [January 14, 2023, 10:58pm UTC](https://discourse.julialang.org/t/how-to-reduce-an-array/92945 "2023-01-14T22:58:13Z")

</div>

Hello The wording is a bit bad in the title and I struggle to explain what I want to do properly, but basically what I want to do is; Suppose I have an array I consisting of indices: I = \[1 1 1 2 2 2 3 3 3\] And an ar…

---

## [Unitful.jl: typeof() vs manually given types](https://discourse.julialang.org/t/unitful-jl-typeof-vs-manually-given-types/92957)

<div class="topic-metadata">

**Author:** [@DOT](https://discourse.julialang.org/u/DOT)\
**Replies:** 4\
**Last updated:** [January 14, 2023, 8:38pm UTC](https://discourse.julialang.org/t/unitful-jl-typeof-vs-manually-given-types/92957 "2023-01-14T20:38:22Z")

</div>

Taking typeof() of some quantity, vs copy+pasting the output as a type definition – these two don’t seem to be equivalent: \> typeof(1.0s) Quantity{Float64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}} \> 1.0s isa typeof(1.0s…

---

## [Rounding the coefficients of a minimax polynomial](https://discourse.julialang.org/t/rounding-the-coefficients-of-a-minimax-polynomial/92873)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 19\
**Last updated:** [January 14, 2023, 7:05pm UTC](https://discourse.julialang.org/t/rounding-the-coefficients-of-a-minimax-polynomial/92873 "2023-01-14T19:05:46Z")

</div>

I’m making a Julia package for automating implementation of univariate real functions using polynomial approximation, but I’m having trouble with rounding the coefficients after a minimax polynomial is found, while prese…

---

## [Exception in Sankey Diagram in Pluto](https://discourse.julialang.org/t/exception-in-sankey-diagram-in-pluto/92955)

<div class="topic-metadata">

**Author:** [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Replies:** 3\
**Last updated:** [January 14, 2023, 2:36pm UTC](https://discourse.julialang.org/t/exception-in-sankey-diagram-in-pluto/92955 "2023-01-14T14:36:05Z")

</div>

I am getting this exception in Pluto while using SankeyPlots. Although i am getting correct sankey plot. Failed to guesstimate plot size exception MethodError: no method matching length(::Nothing) Closest candidates…

---

## [Writing a static function](https://discourse.julialang.org/t/writing-a-static-function/92882)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 22\
**Last updated:** [January 14, 2023, 2:28pm UTC](https://discourse.julialang.org/t/writing-a-static-function/92882 "2023-01-14T14:28:21Z")

</div>

Is it possible to write a static function in Julia with functionality similar to that in C++? function tst\_static() static int count = 0 count = count + 1 println("count = ", count) end for i in \[1,2,3\]:…

---

## [More informative Project.toml or partial Manifest.toml](https://discourse.julialang.org/t/more-informative-project-toml-or-partial-manifest-toml/92804)

<div class="topic-metadata">

**Author:** [@filchristou](https://discourse.julialang.org/u/filchristou)\
**Replies:** 4\
**Last updated:** [January 14, 2023, 9:08am UTC](https://discourse.julialang.org/t/more-informative-project-toml-or-partial-manifest-toml/92804 "2023-01-14T09:08:44Z")

</div>

In the realm of unregisted and local packages, it’s quite common to always carry around the Manifest.toml file. That is because it’s the only way to inform julia about the whereabouts of a package that is not in the publ…

---

## [Suppressing numbers in Franklin as default behavior](https://discourse.julialang.org/t/suppressing-numbers-in-franklin-as-default-behavior/92907)

<div class="topic-metadata">

**Author:** [@guille](https://discourse.julialang.org/u/guille)\
**Replies:** 2\
**Last updated:** [January 14, 2023, 6:20am UTC](https://discourse.julialang.org/t/suppressing-numbers-in-franklin-as-default-behavior/92907 "2023-01-14T06:20:58Z")

</div>

I was wondering if it was possible to universally suppress numberings of equations in Franklin, by chance? In particular, it would be awesome if there was a way to have the behavior of KaTeX and/or Franklin mimic the usu…

---

## [Let statement cannot use return](https://discourse.julialang.org/t/let-statement-cannot-use-return/92948)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 1\
**Last updated:** [January 14, 2023, 2:36am UTC](https://discourse.julialang.org/t/let-statement-cannot-use-return/92948 "2023-01-14T02:36:24Z")

</div>

I am trying to understand the let statement. Particularly how to get variables from within the let scope. julia\> j = 2 2 julia\> c,d = let a = j x = 5a y = 7a return x, y end…

---

## [Why does this type instability lead to allocations?](https://discourse.julialang.org/t/why-does-this-type-instability-lead-to-allocations/92821)

<div class="topic-metadata">

**Author:** [@user664303](https://discourse.julialang.org/u/user664303)\
**Replies:** 3\
**Last updated:** [January 13, 2023, 6:48pm UTC](https://discourse.julialang.org/t/why-does-this-type-instability-lead-to-allocations/92821 "2023-01-13T18:48:15Z")

</div>

I previously posted a question about dynamic dispatch leading to allocations. The answer I got was that the type instability that leads to dynamic dispatch also leads to the allocations - at least that’s what I understoo…

---

## [Problem linking HDF5.jl to system libhdf5](https://discourse.julialang.org/t/problem-linking-hdf5-jl-to-system-libhdf5/92931)

<div class="topic-metadata">

**Author:** [@johnomotani](https://discourse.julialang.org/u/johnomotani)\
**Replies:** 8\
**Last updated:** [January 13, 2023, 6:25pm UTC](https://discourse.julialang.org/t/problem-linking-hdf5-jl-to-system-libhdf5/92931 "2023-01-13T18:25:01Z")

</div>

I am trying to use HDF5.jl with the system-provided libhdf5 (in order to use MPI), following the instructions here: Home · HDF5.jl. I get an error about ‘failing to find libhdf5’, even though the library is present in t…

---

## [Could not start the Julia language server. Make sure the \`julia.environmentPath\` setting is valid](https://discourse.julialang.org/t/could-not-start-the-julia-language-server-make-sure-the-julia-environmentpath-setting-is-valid/87794)

<div class="topic-metadata">

**Author:** [@tryjulia](https://discourse.julialang.org/u/tryjulia)\
**Replies:** 9\
**Last updated:** [January 13, 2023, 3:20pm UTC](https://discourse.julialang.org/t/could-not-start-the-julia-language-server-make-sure-the-julia-environmentpath-setting-is-valid/87794 "2023-01-13T15:20:27Z")

</div>

Hi, I’m new to MacOs, and currently want to use VS Code to run julia into the system but there’s notification: Could not start the Julia language server. Make sure the julia.environmentPath setting is valid. I’ve …

---

## [Advice needed on multithreaded processing for live data from a UDP socket](https://discourse.julialang.org/t/advice-needed-on-multithreaded-processing-for-live-data-from-a-udp-socket/91948)

<div class="topic-metadata">

**Author:** [@tt1234567](https://discourse.julialang.org/u/tt1234567)\
**Replies:** 2\
**Last updated:** [January 13, 2023, 3:10pm UTC](https://discourse.julialang.org/t/advice-needed-on-multithreaded-processing-for-live-data-from-a-udp-socket/91948 "2023-01-13T15:10:11Z")

</div>

I have an application which receives data from a sensor via UDP, does some processing and displays the results. The data is read in a separate thread and buffered using a Channel. It’s important that the receiver thread …

---

## [Creating a List of 100 Binomial Distributed Values](https://discourse.julialang.org/t/creating-a-list-of-100-binomial-distributed-values/92903)

<div class="topic-metadata">

**Author:** [@BadBoy](https://discourse.julialang.org/u/BadBoy)\
**Replies:** 9\
**Last updated:** [January 13, 2023, 2:22pm UTC](https://discourse.julialang.org/t/creating-a-list-of-100-binomial-distributed-values/92903 "2023-01-13T14:22:21Z")

</div>

I want a list x it contain 1 and -1, if rand(Binomial(1,0.5),1)\[1\] == 1 is true the value in that position of x is 1 and if it is not true then the value is -1 . i need to do this for 100 many times, so my length of x sh…

---

## [Need help implementing non-allocating normal distribution with StaticArrays](https://discourse.julialang.org/t/need-help-implementing-non-allocating-normal-distribution-with-staticarrays/92919)

<div class="topic-metadata">

**Author:** [@vpetukhov](https://discourse.julialang.org/u/vpetukhov)\
**Replies:** 2\
**Last updated:** [January 13, 2023, 2:12pm UTC](https://discourse.julialang.org/t/need-help-implementing-non-allocating-normal-distribution-with-staticarrays/92919 "2023-01-13T14:12:37Z")

</div>

I’m trying to implement a zero-allocating version of a normal distribution pdf, but get some unexpected allocations. Below is my code for a script ./test\_allocations.jl, which could be ran to test allocations quickly. u…

---

## [How to return in-place two variables from fetch?](https://discourse.julialang.org/t/how-to-return-in-place-two-variables-from-fetch/92880)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 5\
**Last updated:** [January 13, 2023, 1:39pm UTC](https://discourse.julialang.org/t/how-to-return-in-place-two-variables-from-fetch/92880 "2023-01-13T13:39:49Z")

</div>

I have two issues please: 1- How can I mutate in-place x\_1&x\_2 by the returns of fetch ( Z and Y ) to avoid the below error? A = \[1,2,3,4,5\] x\_1 = zeros(5); x\_2 = zeros(5); thr = Threads.@spawn begin Z = A .+ 1; Y …

---

## [How to achieve perfect scaling with Threads (Julia 1.7.1)](https://discourse.julialang.org/t/how-to-achieve-perfect-scaling-with-threads-julia-1-7-1/92603)

<div class="topic-metadata">

**Author:** [@Salmon](https://discourse.julialang.org/u/Salmon)\
**Replies:** 33\
**Last updated:** [January 13, 2023, 11:07am UTC](https://discourse.julialang.org/t/how-to-achieve-perfect-scaling-with-threads-julia-1-7-1/92603 "2023-01-13T11:07:20Z")

</div>

Hi everyone, I am currently investigating a scaling bottleneck in one of my codes which seems a bit elusive to me. In my investigation to get a MWE, I have tried to produce a somewhat representative example, which shou…

---

## [Segfault in DataStructures.jl](https://discourse.julialang.org/t/segfault-in-datastructures-jl/92913)

<div class="topic-metadata">

**Author:** [@Joseph\_Bradley](https://discourse.julialang.org/u/Joseph_Bradley)\
**Replies:** 0\
**Last updated:** [January 13, 2023, 9:44am UTC](https://discourse.julialang.org/t/segfault-in-datastructures-jl/92913 "2023-01-13T09:44:01Z")

</div>

I am getting the following segfault in the midst of some other code: signal (11): Segmentation fault: 11 in expression starting at REPL\[67\]:1 gc\_mark\_loop at /Applications/Julia-1.8.app/Contents/Resources/julia/lib/juli…

---

## [How to Plot Cycloid with Plots?](https://discourse.julialang.org/t/how-to-plot-cycloid-with-plots/92909)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 1\
**Last updated:** [January 13, 2023, 8:02am UTC](https://discourse.julialang.org/t/how-to-plot-cycloid-with-plots/92909 "2023-01-13T08:02:50Z")

</div>

Hi all, I want to plot the cycloid, with PartialCircle, I think it is not working… Here is my code / MWE: using Plots, LaTeXStrings; gr() # To plot a circle of radius 2 centered at (0, 0) θ = 0:0.01:2π x = 0 .+ 2c…

---

## [Zip folder using Julia](https://discourse.julialang.org/t/zip-folder-using-julia/69565)

<div class="topic-metadata">

**Author:** [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Replies:** 8\
**Last updated:** [January 13, 2023, 7:41am UTC](https://discourse.julialang.org/t/zip-folder-using-julia/69565 "2023-01-13T07:41:47Z")

</div>

Hi! How to zip an entire folder using Julia? I tried using ZipFile with no success. Thanks.

---

## [Why isn't SnoopPrecompile being able to fully compile the calls in this case?](https://discourse.julialang.org/t/why-isnt-snoopprecompile-being-able-to-fully-compile-the-calls-in-this-case/92849)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 10\
**Last updated:** [January 13, 2023, 7:36am UTC](https://discourse.julialang.org/t/why-isnt-snoopprecompile-being-able-to-fully-compile-the-calls-in-this-case/92849 "2023-01-13T07:36:49Z")

</div>

I have a PR to BandedMatrices with the following SnoopPrecompile instructions: @precompile\_setup begin vs = (\[1.0\], Float32\[1.0\], ComplexF32\[1.0\], ComplexF64\[1.0\]) Bs = Any\[BandedMatrix(0 =\> v) for v in vs\] @precompi…

---

## [Extremely tiny font in pyplot windows](https://discourse.julialang.org/t/extremely-tiny-font-in-pyplot-windows/92863)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 2\
**Last updated:** [January 13, 2023, 6:51am UTC](https://discourse.julialang.org/t/extremely-tiny-font-in-pyplot-windows/92863 "2023-01-13T06:51:07Z")

</div>

This is a somewhat unusual issue that I’m facing: the font sizes in the matplotlib windows is far too small: I’m using PyPlot.jl for my plots, and trying to save the plot from the icon in the plot window. Does anyon…

---

## [Why CRC32c but missing CRC32](https://discourse.julialang.org/t/why-crc32c-but-missing-crc32/92075)

<div class="topic-metadata">

**Author:** [@jling](https://discourse.julialang.org/u/jling)\
**Replies:** 10\
**Last updated:** [January 13, 2023, 1:52am UTC](https://discourse.julialang.org/t/why-crc32c-but-missing-crc32/92075 "2023-01-13T01:52:30Z")

</div>

I just found out that CRC32 and CRC32c are two different things, and the latter we have in stdlib: CRC32c · The Julia Language julia\> using CRC32c julia\> CRC32c.crc32c(UInt8\[1,0,1,0,0,0,0,0,0,0\]) 0x61b7f6e9 julia\> CRC…

---

## [How to update individual sparse matrices mapped to sparse diagonal-matrix efficiently?](https://discourse.julialang.org/t/how-to-update-individual-sparse-matrices-mapped-to-sparse-diagonal-matrix-efficiently/92900)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 2\
**Last updated:** [January 12, 2023, 11:11pm UTC](https://discourse.julialang.org/t/how-to-update-individual-sparse-matrices-mapped-to-sparse-diagonal-matrix-efficiently/92900 "2023-01-12T23:11:15Z")

</div>

I have a simple MWE below that includes a diagonal sparse matrix A and its sub-diagonal matrices A\_1,A\_2,A\_3. Assuming that A is going to be updated in values only (pattern is fixed), what is the efficient way to update A…

---

## [What to do when command \`\`\`notebook()\`\`\` won't prompt a Jupyter installation?](https://discourse.julialang.org/t/what-to-do-when-command-notebook-wont-prompt-a-jupyter-installation/92897)

<div class="topic-metadata">

**Author:** [@Hugo](https://discourse.julialang.org/u/Hugo)\
**Replies:** 2\
**Last updated:** [January 12, 2023, 11:01pm UTC](https://discourse.julialang.org/t/what-to-do-when-command-notebook-wont-prompt-a-jupyter-installation/92897 "2023-01-12T23:01:07Z")

</div>

TL;DR: How to make Julia find the jupyter kernel so Quarto can run? I just installed a new version of Julia (1.8.5) and, given the problems I am dealing with, I assume the packages I had installed didn’t migrate to the …

---

## [Questions related to updating Julia](https://discourse.julialang.org/t/questions-related-to-updating-julia/92896)

<div class="topic-metadata">

**Author:** [@Leon6](https://discourse.julialang.org/u/Leon6)\
**Replies:** 6\
**Last updated:** [January 12, 2023, 10:45pm UTC](https://discourse.julialang.org/t/questions-related-to-updating-julia/92896 "2023-01-12T22:45:10Z")

</div>

I’m on Mac OS Venture 13.1 and am trying to upgrade from my current v1.7 to v1.8.5.After downloading and installing the dmg file now I have both versions in my Application folder. How should I remove the old version and…

---

## [Invalidations findings (from a GMT case)](https://discourse.julialang.org/t/invalidations-findings-from-a-gmt-case/92420)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 64\
**Last updated:** [January 12, 2023, 8:46pm UTC](https://discourse.julialang.org/t/invalidations-findings-from-a-gmt-case/92420 "2023-01-12T20:46:39Z")

</div>

Continuing from Julia v1.9.0-beta2 is fast and using Tim’s recipe using SnoopCompileCore invs = @snoopr using GMT tinf = @snoopi\_deep plot(rand(5,2)); using SnoopCompile trees = invalidation\_trees(invs); taletrees = pr…

---

## [When activating the environment won't work](https://discourse.julialang.org/t/when-activating-the-environment-wont-work/92893)

<div class="topic-metadata">

**Author:** [@Hugo](https://discourse.julialang.org/u/Hugo)\
**Replies:** 2\
**Last updated:** [January 12, 2023, 8:44pm UTC](https://discourse.julialang.org/t/when-activating-the-environment-wont-work/92893 "2023-01-12T20:44:52Z")

</div>

I am working on a project using VSCode as my IDE. I created a project once, and since then I have been activating the its environment every time I work on that project. I usually have no problems with it, but today I’m …

---

## [Blackbox optimization fitness evolution non-monotonic](https://discourse.julialang.org/t/blackbox-optimization-fitness-evolution-non-monotonic/92891)

<div class="topic-metadata">

**Author:** [@mengxiaoliu](https://discourse.julialang.org/u/mengxiaoliu)\
**Replies:** 0\
**Last updated:** [January 12, 2023, 7:40pm UTC](https://discourse.julialang.org/t/blackbox-optimization-fitness-evolution-non-monotonic/92891 "2023-01-12T19:40:14Z")

</div>

Hi all, I use the default algorithm (rand/1/bin) in the BlackBoxOptim package to optimize a single-objective function. Here is a plot of the best fitness per generation: I am not sure why the best fitness does not d…

---

## [BigFloat type promotion != precision promotion](https://discourse.julialang.org/t/bigfloat-type-promotion-precision-promotion/91945)

<div class="topic-metadata">

**Author:** [@gvdeynde](https://discourse.julialang.org/u/gvdeynde)\
**Replies:** 16\
**Last updated:** [January 12, 2023, 6:11pm UTC](https://discourse.julialang.org/t/bigfloat-type-promotion-precision-promotion/91945 "2023-01-12T18:11:06Z")

</div>

Hi all I’m a bit confused on the rules of precision “promotion” using BigFloats. As far as I can see, there are none. See example below. From this, I can conclude that Type promotion is made (the result of an operatio…

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

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