# General Usage

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

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

**Page:** 235

---

## [Good error messages](https://discourse.julialang.org/t/good-error-messages/105523)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 5\
**Last updated:** [October 28, 2023, 10:39pm UTC](https://discourse.julialang.org/t/good-error-messages/105523 "2023-10-28T22:39:48Z")

</div>

I often find error messages like this impractical: julia\> only(\[1, 2\]) ERROR: ArgumentError: Collection has multiple elements, must contain exactly 1 element We don’t know what the Collection is, we don’t know what the…

---

## [Why do these allocate?!](https://discourse.julialang.org/t/why-do-these-allocate/105497)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 4\
**Last updated:** [October 28, 2023, 12:58pm UTC](https://discourse.julialang.org/t/why-do-these-allocate/105497 "2023-10-28T12:58:36Z")

</div>

The functions shuf1 and shuf2 are two different implementations of a Fisher-Yates shuffle for tuples. Why do both allocate, even in trivial cases? The recursion depth should be small and a compile-time constant and all t…

---

## [How to slightly extend a range?](https://discourse.julialang.org/t/how-to-slightly-extend-a-range/105499)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 6\
**Last updated:** [October 28, 2023, 12:46pm UTC](https://discourse.julialang.org/t/how-to-slightly-extend-a-range/105499 "2023-10-28T12:46:46Z")

</div>

Hello! Suppose I have a range: r = 1:10 I found a function to extend the range: extended\_range(r,δ) = (first(r) - δ):step(r):(last(r) + δ) But I observe some different behaviours: extended\_range(r,1) 0:1:11 extend…

---

## [Choose your own adventure on steroid with multiple dispatch?](https://discourse.julialang.org/t/choose-your-own-adventure-on-steroid-with-multiple-dispatch/105495)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 0\
**Last updated:** [October 28, 2023, 2:42am UTC](https://discourse.julialang.org/t/choose-your-own-adventure-on-steroid-with-multiple-dispatch/105495 "2023-10-28T02:42:11Z")

</div>

Let’s entertain an idea. What implication lies ahead is up to your interpretation. Typically, choose-your-own-adventure authors are limited to about two options. Branches the storyline, and overwhelm yourself with wor…

---

## [Help finding function -- concatenate strings with separator](https://discourse.julialang.org/t/help-finding-function-concatenate-strings-with-separator/105488)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 2\
**Last updated:** [October 27, 2023, 5:59pm UTC](https://discourse.julialang.org/t/help-finding-function-concatenate-strings-with-separator/105488 "2023-10-27T17:59:35Z")

</div>

I am having trouble finding a function that I am pretty sure exists. Suppose I have a vector of strings. I want to concatenate these strings into one longer string, but with a separator in-between each. Doesn’t this func…

---

## [Speeding up the calculation of Liouville function](https://discourse.julialang.org/t/speeding-up-the-calculation-of-liouville-function/105447)

<div class="topic-metadata">

**Author:** [@HMegh](https://discourse.julialang.org/u/HMegh)\
**Replies:** 4\
**Last updated:** [October 27, 2023, 5:15pm UTC](https://discourse.julialang.org/t/speeding-up-the-calculation-of-liouville-function/105447 "2023-10-27T17:15:20Z")

</div>

Hi! In my journey to learn Julia, I was trying to find the smallest counter example of Polya’s conjecture which is a little less than 10^9, while using as little memory as possible. Any tips on how to optimize the algo…

---

## [Transfer/ Unbox Julia's DataFrame objects and use as C++ object](https://discourse.julialang.org/t/transfer-unbox-julias-dataframe-objects-and-use-as-c-object/105440)

<div class="topic-metadata">

**Author:** [@Ivan\_Navarro](https://discourse.julialang.org/u/Ivan_Navarro)\
**Replies:** 12\
**Last updated:** [October 27, 2023, 4:36pm UTC](https://discourse.julialang.org/t/transfer-unbox-julias-dataframe-objects-and-use-as-c-object/105440 "2023-10-27T16:36:37Z")

</div>

NOTE: Cross posting from Transfer/ Unbox Julia's DataFrame objects and use as C++ object - Stack Overflow I would like to (un)box complex objects like DataFrames created in Julia, from C++. So I can use as input data fo…

---

## [Bundling Julia GUI application for Windows](https://discourse.julialang.org/t/bundling-julia-gui-application-for-windows/105328)

<div class="topic-metadata">

**Author:** [@Janis\_Erdmanis](https://discourse.julialang.org/u/Janis_Erdmanis)\
**Replies:** 6\
**Last updated:** [October 27, 2023, 1:17pm UTC](https://discourse.julialang.org/t/bundling-julia-gui-application-for-windows/105328 "2023-10-27T13:17:30Z")

</div>

I am wondering has anyone has tried to bundle a Julia application for Universal Windows Platform (UWP) using the MSIX bundle? I am currently working on a cross-platform bundler for Julia GUI applications called AppBundl…

---

## [Collecting data by allocatable array](https://discourse.julialang.org/t/collecting-data-by-allocatable-array/105484)

<div class="topic-metadata">

**Author:** [@Photon](https://discourse.julialang.org/u/Photon)\
**Replies:** 1\
**Last updated:** [October 27, 2023, 3:31pm UTC](https://discourse.julialang.org/t/collecting-data-by-allocatable-array/105484 "2023-10-27T15:31:43Z")

</div>

Suppose there is a file, containing a series of data, and the number of data is unknown before reading the file. To collect all data in this file, is there a kind of array in Julia for this purpose, just like the alloca…

---

## [How to see doc page of GitHub PR](https://discourse.julialang.org/t/how-to-see-doc-page-of-github-pr/105454)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 4\
**Last updated:** [October 27, 2023, 2:59pm UTC](https://discourse.julialang.org/t/how-to-see-doc-page-of-github-pr/105454 "2023-10-27T14:59:16Z")

</div>

Have asked people this, but cannot find it anywhere using search functions. I have a PR to a Julia package hosted on GitHub (with documentation produced in, what I think is, the normal Julia way): General doc update by …

---

## [Stdout appears as type instable](https://discourse.julialang.org/t/stdout-appears-as-type-instable/105481)

<div class="topic-metadata">

**Author:** [@Shayan](https://discourse.julialang.org/u/Shayan)\
**Replies:** 6\
**Last updated:** [October 27, 2023, 2:28pm UTC](https://discourse.julialang.org/t/stdout-appears-as-type-instable/105481 "2023-10-27T14:28:59Z")

</div>

I made the following progress bar, but according to @code\_warntype it is somewhat type instable. How can I make it type stable? function progressbar(ntimes::S, current::S) where S\<:Int val = current/ntimes val\_round…

---

## [How to find out the version of a package from its module](https://discourse.julialang.org/t/how-to-find-out-the-version-of-a-package-from-its-module/37755)

<div class="topic-metadata">

**Author:** [@fingolfin](https://discourse.julialang.org/u/fingolfin)\
**Replies:** 16\
**Last updated:** [October 27, 2023, 9:29am UTC](https://discourse.julialang.org/t/how-to-find-out-the-version-of-a-package-from-its-module/37755 "2023-10-27T09:29:57Z")

</div>

Suppose I just did using Foo. How do I find out the version of Foo.jl given the module Foo ? The only way I found was to know the UUID of the package and query Pkg. I am hoping I am just overlooking something simple? Id…

---

## [@code\_warntype result depending on compiled functions](https://discourse.julialang.org/t/code-warntype-result-depending-on-compiled-functions/105471)

<div class="topic-metadata">

**Author:** [@Marco\_Lombardi](https://discourse.julialang.org/u/Marco_Lombardi)\
**Replies:** 0\
**Last updated:** [October 27, 2023, 8:55am UTC](https://discourse.julialang.org/t/code-warntype-result-depending-on-compiled-functions/105471 "2023-10-27T08:55:16Z")

</div>

I am writing a fairly large project and I am trying to be very careful about type stability by checking all functions I write with @code\_warntype and the JET tests. Doing these tests, I found something very strange that …

---

## [Appropriate warning for size using code\_warntype](https://discourse.julialang.org/t/appropriate-warning-for-size-using-code-warntype/105457)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 2\
**Last updated:** [October 27, 2023, 8:39am UTC](https://discourse.julialang.org/t/appropriate-warning-for-size-using-code-warntype/105457 "2023-10-27T08:39:12Z")

</div>

I tried profiling some code using JET. When I used size() on a matrix of type Any, the warning came back that the output of the function size is of type Any. This confused me because I thought size could only output of…

---

## [How to improve the implementation of a function involving a numerical integration?](https://discourse.julialang.org/t/how-to-improve-the-implementation-of-a-function-involving-a-numerical-integration/105444)

<div class="topic-metadata">

**Author:** [@lsablon](https://discourse.julialang.org/u/lsablon)\
**Replies:** 7\
**Last updated:** [October 27, 2023, 4:10am UTC](https://discourse.julialang.org/t/how-to-improve-the-implementation-of-a-function-involving-a-numerical-integration/105444 "2023-10-27T04:10:03Z")

</div>

Hello, I am trying to optimize my code, but I don’t really know in which direction I should go (but I know I don’t want to use multithreading). Here is my goal: I want to implement the following function k\_\\perp(x,y;…

---

## [Create data frame using values from vector as columns](https://discourse.julialang.org/t/create-data-frame-using-values-from-vector-as-columns/105416)

<div class="topic-metadata">

**Author:** [@Sandy45](https://discourse.julialang.org/u/Sandy45)\
**Replies:** 6\
**Last updated:** [October 26, 2023, 9:00pm UTC](https://discourse.julialang.org/t/create-data-frame-using-values-from-vector-as-columns/105416 "2023-10-26T21:00:19Z")

</div>

I have data frame which has column say “minutes” and I need to create another data frame using “minutes” as columns as shown below. I was able to create using reshape but values are being concatenated where I need them …

---

## [Solving ODE with inheritance of initial condition with parallelization by threads](https://discourse.julialang.org/t/solving-ode-with-inheritance-of-initial-condition-with-parallelization-by-threads/105418)

<div class="topic-metadata">

**Author:** [@Sergey\_Novak](https://discourse.julialang.org/u/Sergey_Novak)\
**Replies:** 3\
**Last updated:** [October 26, 2023, 1:29pm UTC](https://discourse.julialang.org/t/solving-ode-with-inheritance-of-initial-condition-with-parallelization-by-threads/105418 "2023-10-26T13:29:05Z")

</div>

Hello! I have an ODE and I need to perform inheritance of initial conditions when changing two parameters. I can do this without parallelizing threads, and everything works correctly. But when I start parallelizing, I g…

---

## [Saving to a file during parallel computation](https://discourse.julialang.org/t/saving-to-a-file-during-parallel-computation/105425)

<div class="topic-metadata">

**Author:** [@Sergey\_Novak](https://discourse.julialang.org/u/Sergey_Novak)\
**Replies:** 17\
**Last updated:** [October 26, 2023, 1:17pm UTC](https://discourse.julialang.org/t/saving-to-a-file-during-parallel-computation/105425 "2023-10-26T13:17:17Z")

</div>

Hello! I have a parallel program, and when I try to save data, I encounter the following error. Should I use channels when saving data to a file? Or is the problem solved in some other way? Thank you for your help Fra…

---

## [Cannot update Julia package to newest versions](https://discourse.julialang.org/t/cannot-update-julia-package-to-newest-versions/105441)

<div class="topic-metadata">

**Author:** [@erasedbird](https://discourse.julialang.org/u/erasedbird)\
**Replies:** 3\
**Last updated:** [October 26, 2023, 12:36pm UTC](https://discourse.julialang.org/t/cannot-update-julia-package-to-newest-versions/105441 "2023-10-26T12:36:45Z")

</div>

I am using Julia 1.9.2, and I’m trying to update CUDA from 4.0.1 to 4.4.0 and KernelAbstractions from 0.8.7 to 0.9.8. I’ve tried the following in Pkg mode: Using up (no changes to Project.toml and Manifest.toml, nothin…

---

## [How to force an object to be freed by the garbage collector](https://discourse.julialang.org/t/how-to-force-an-object-to-be-freed-by-the-garbage-collector/77985)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 19\
**Last updated:** [October 26, 2023, 12:11pm UTC](https://discourse.julialang.org/t/how-to-force-an-object-to-be-freed-by-the-garbage-collector/77985 "2023-10-26T12:11:44Z")

</div>

From this very old post (https://groups.google.com/g/julia-users/c/QkChqeKnd9g/m/cqltIs5doQoJ) I was led to believe that the call to gc below would free the memory allocated by X, but it doesn’t. How could I force the r…

---

## [Macro that inlines functions](https://discourse.julialang.org/t/macro-that-inlines-functions/105391)

<div class="topic-metadata">

**Author:** [@f.ij](https://discourse.julialang.org/u/f.ij)\
**Replies:** 10\
**Last updated:** [October 26, 2023, 7:40am UTC](https://discourse.julialang.org/t/macro-that-inlines-functions/105391 "2023-10-26T07:40:42Z")

</div>

I want to use some inlinable functions with @turbo for cleaner syntax, which currently does not work. Is it possible to write a macro that gets an expression, and then for every function that should inline, replaces it …

---

## [Refactoring a symmetric matrix into a vector and back again](https://discourse.julialang.org/t/refactoring-a-symmetric-matrix-into-a-vector-and-back-again/105378)

<div class="topic-metadata">

**Author:** [@ignace](https://discourse.julialang.org/u/ignace)\
**Replies:** 2\
**Last updated:** [October 26, 2023, 7:06am UTC](https://discourse.julialang.org/t/refactoring-a-symmetric-matrix-into-a-vector-and-back-again/105378 "2023-10-26T07:06:23Z")

</div>

Hallo, Do you know ‘good’ ways to refactor a symmetric matrix into a vector, and back again? Ideally, something like this: A = \[1 2 3; 2 4 5; 3 5 6\] V = mat2vec(A) # V = \[1 2 3 4 5 6\] A = vec2mat(V) # A…

---

## [Subtype a struct in package extension, but defining the struct in the Main Package code](https://discourse.julialang.org/t/subtype-a-struct-in-package-extension-but-defining-the-struct-in-the-main-package-code/105380)

<div class="topic-metadata">

**Author:** [@Qfl3x](https://discourse.julialang.org/u/Qfl3x)\
**Replies:** 1\
**Last updated:** [October 26, 2023, 6:38am UTC](https://discourse.julialang.org/t/subtype-a-struct-in-package-extension-but-defining-the-struct-in-the-main-package-code/105380 "2023-10-26T06:38:40Z")

</div>

While trying to transfer a package’s @requires into extensions, I wanted to take the structs into the Main package. However, one of the structs is defined as a subtype of a weakdep. So something like: In Foo/ext/FooBarE…

---

## [How do I change the REPL prompt to show numbers?](https://discourse.julialang.org/t/how-do-i-change-the-repl-prompt-to-show-numbers/105406)

<div class="topic-metadata">

**Author:** [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Replies:** 2\
**Last updated:** [October 26, 2023, 4:51am UTC](https://discourse.julialang.org/t/how-do-i-change-the-repl-prompt-to-show-numbers/105406 "2023-10-26T04:51:04Z")

</div>

I know one can change the REPL prompt to show numbers instead of julia\>. I believe there is also a way to GOTO a number. How does one do that?

---

## [Julia 0.7 nightlies for ppc64le](https://discourse.julialang.org/t/julia-0-7-nightlies-for-ppc64le/5540)

<div class="topic-metadata">

**Author:** [@raminammour](https://discourse.julialang.org/u/raminammour)\
**Replies:** 4\
**Last updated:** [October 26, 2023, 2:23am UTC](https://discourse.julialang.org/t/julia-0-7-nightlies-for-ppc64le/5540 "2023-10-26T02:23:23Z")

</div>

Hello, Does anyone have a working link for 0.7 precompiled nightlies for ppc64le? The link on the download page shows: This XML file does not appear to have any style information associated with it. The document tree i…

---

## [How to make Configurations.jl option fields extensible (abstract?)](https://discourse.julialang.org/t/how-to-make-configurations-jl-option-fields-extensible-abstract/105360)

<div class="topic-metadata">

**Author:** [@Sevi](https://discourse.julialang.org/u/Sevi)\
**Replies:** 5\
**Last updated:** [October 25, 2023, 10:04pm UTC](https://discourse.julialang.org/t/how-to-make-configurations-jl-option-fields-extensible-abstract/105360 "2023-10-25T22:04:13Z")

</div>

I’m using Configurations.jl quite extensively to run some simulations and it’s pretty amazing! There is one scenario, however, which I’m not quite sure how to solve in an “elegant” way, so I just want to gather some tho…

---

## [Loop Vectorization syntax very limiting](https://discourse.julialang.org/t/loop-vectorization-syntax-very-limiting/105387)

<div class="topic-metadata">

**Author:** [@f.ij](https://discourse.julialang.org/u/f.ij)\
**Replies:** 7\
**Last updated:** [October 25, 2023, 8:05pm UTC](https://discourse.julialang.org/t/loop-vectorization-syntax-very-limiting/105387 "2023-10-25T20:05:50Z")

</div>

I’m using LoopVectorization to speed up some function to great effect. However, I’m finding the syntax it allows to be quite limiting. I’m loping over a sparse matrix like this to gather an energy function. It works grea…

---

## [Precompile/build an extension](https://discourse.julialang.org/t/precompile-build-an-extension/105345)

<div class="topic-metadata">

**Author:** [@Qfl3x](https://discourse.julialang.org/u/Qfl3x)\
**Replies:** 3\
**Last updated:** [October 25, 2023, 6:41pm UTC](https://discourse.julialang.org/t/precompile-build-an-extension/105345 "2023-10-25T18:41:24Z")

</div>

Hello, is it currently possible to manually (equivalent of pkg\> build) precompile a package extension after modifying it?

---

## [Type-inference fails then succeeds for exact same function](https://discourse.julialang.org/t/type-inference-fails-then-succeeds-for-exact-same-function/105384)

<div class="topic-metadata">

**Author:** [@Bizzi](https://discourse.julialang.org/u/Bizzi)\
**Replies:** 2\
**Last updated:** [October 25, 2023, 5:19pm UTC](https://discourse.julialang.org/t/type-inference-fails-then-succeeds-for-exact-same-function/105384 "2023-10-25T17:19:41Z")

</div>

I’ve been facing multiple issues with type-inference, specially when using ComponentArrays. In particular, it may succeed or fail, apparently at random, for the same function, in the same program. What could be causing t…

---

## [Optimizing Complex Batch Matrix Multiplication](https://discourse.julialang.org/t/optimizing-complex-batch-matrix-multiplication/105381)

<div class="topic-metadata">

**Author:** [@quantumtwist](https://discourse.julialang.org/u/quantumtwist)\
**Replies:** 2\
**Last updated:** [October 25, 2023, 3:31pm UTC](https://discourse.julialang.org/t/optimizing-complex-batch-matrix-multiplication/105381 "2023-10-25T15:31:16Z")

</div>

Hello fellow Julians! In my code the bottleneck step is a batched ComplexF64 matrix multiplication of the form C\[i,k,n\] = conj(A)\[j,i,n\] \* B\[j,k,n\]. Naively, one should loop over n and do in-place multiplication. Howeve…

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

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