# General Usage

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

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

**Page:** 187

---

## [Memory allocation in recursion](https://discourse.julialang.org/t/memory-allocation-in-recursion/111929)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 11\
**Last updated:** [March 21, 2024, 8:08pm UTC](https://discourse.julialang.org/t/memory-allocation-in-recursion/111929 "2024-03-21T20:08:27Z")

</div>

Does Julia allocate memory when recursing? I see a ton of memory allocation in a recursive quicksort…

---

## [Create set of of non-slice arrays referencing contiguous memory](https://discourse.julialang.org/t/create-set-of-of-non-slice-arrays-referencing-contiguous-memory/111908)

<div class="topic-metadata">

**Author:** [@bremez](https://discourse.julialang.org/u/bremez)\
**Replies:** 7\
**Last updated:** [March 21, 2024, 3:05pm UTC](https://discourse.julialang.org/t/create-set-of-of-non-slice-arrays-referencing-contiguous-memory/111908 "2024-03-21T15:05:34Z")

</div>

I have a use case where I manipulate an AbstractVector{Vector{Int64}}, each of the latter of the same length. I then do many element-by-element computations between pairs of vectors in the set. There are N~100 vectors of…

---

## [Running Julia in browser - sharing simulation code that plots live. Possible?](https://discourse.julialang.org/t/running-julia-in-browser-sharing-simulation-code-that-plots-live-possible/106835)

<div class="topic-metadata">

**Author:** [@p\_f](https://discourse.julialang.org/u/p_f)\
**Replies:** 5\
**Last updated:** [March 21, 2024, 1:58pm UTC](https://discourse.julialang.org/t/running-julia-in-browser-sharing-simulation-code-that-plots-live-possible/106835 "2024-03-21T13:58:23Z")

</div>

I have some simulation code that runs, constantly plots to a GLMakie window using observables, and lets me use sliders to change parameter values live. I was wondering if it is possible to share this publically on a webp…

---

## [Recursion in Julia — bad idea?](https://discourse.julialang.org/t/recursion-in-julia-bad-idea/99304)

<div class="topic-metadata">

**Author:** [@rgu](https://discourse.julialang.org/u/rgu)\
**Replies:** 13\
**Last updated:** [May 24, 2023, 1:26pm UTC](https://discourse.julialang.org/t/recursion-in-julia-bad-idea/99304 "2023-05-24T13:26:22Z")

</div>

I’m trying to learn Julia on examples. For now I’m trying to solve some problem with DFS as a core algorithm in my solution. This recursive DFS is running on a max 1000×1000 grid and I’ve got StackOverFlow (I’m pretty s…

---

## [About the use of the test suite when developing a package](https://discourse.julialang.org/t/about-the-use-of-the-test-suite-when-developing-a-package/111862)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 21\
**Last updated:** [March 21, 2024, 7:32am UTC](https://discourse.julialang.org/t/about-the-use-of-the-test-suite-when-developing-a-package/111862 "2024-03-21T07:32:59Z")

</div>

I have added a test suite to the package that is in development, where I am using LinearAlgebra in the MyPkg/test/runtests.jl file without add-ing it in the sub-environment test before the use. I can run the runtests.jl …

---

## [Type parameters & constructors](https://discourse.julialang.org/t/type-parameters-constructors/111874)

<div class="topic-metadata">

**Author:** [@mdsalerno](https://discourse.julialang.org/u/mdsalerno)\
**Replies:** 3\
**Last updated:** [March 21, 2024, 1:55am UTC](https://discourse.julialang.org/t/type-parameters-constructors/111874 "2024-03-21T01:55:10Z")

</div>

I’ve defined the following type: struct ComplexNumber{T\<:Real} \<: Number re::T im::T end I am having trouble understanding why the following two outer constructors behave differently: ComplexNumber(x::Real, y:…

---

## [Swapping in a Binary Search Tree, and Leaf-Only Trees](https://discourse.julialang.org/t/swapping-in-a-binary-search-tree-and-leaf-only-trees/111839)

<div class="topic-metadata">

**Author:** [@narnold0](https://discourse.julialang.org/u/narnold0)\
**Replies:** 3\
**Last updated:** [March 20, 2024, 2:48pm UTC](https://discourse.julialang.org/t/swapping-in-a-binary-search-tree-and-leaf-only-trees/111839 "2024-03-20T14:48:42Z")

</div>

Hi there, I’m trying to implement the Bentley-Ottmann Algorithm in Julia. My problem is that I’ve only found out now that this Algorithm doesn’t utilize the normal implementation of a BST (AVL tree, RedBlack tree etc… f…

---

## [How to fix error UndefVarError when eval using?](https://discourse.julialang.org/t/how-to-fix-error-undefvarerror-when-eval-using/93503)

<div class="topic-metadata">

**Author:** [@Tatiana\_P](https://discourse.julialang.org/u/Tatiana_P)\
**Replies:** 1\
**Last updated:** [March 20, 2024, 11:21pm UTC](https://discourse.julialang.org/t/how-to-fix-error-undefvarerror-when-eval-using/93503 "2024-03-20T23:21:05Z")

</div>

I have some string with function (curve\_expr). I need to give another name to this function and then use find\_zero for my model. Unfortunatelly, I got the error: UndefVarError(:find\_zero). Here are the code: i=1 j=2 cu…

---

## [\`eval(Symbol("varname")\` causes \`UndefVarError\` although the variable is defined](https://discourse.julialang.org/t/eval-symbol-varname-causes-undefvarerror-although-the-variable-is-defined/23726)

<div class="topic-metadata">

**Author:** [@leejm516](https://discourse.julialang.org/u/leejm516)\
**Replies:** 8\
**Last updated:** [March 20, 2024, 11:16pm UTC](https://discourse.julialang.org/t/eval-symbol-varname-causes-undefvarerror-although-the-variable-is-defined/23726 "2024-03-20T23:16:20Z")

</div>

I am revising the codes of COBRA.jl for using it on julia \> 1.0. https://github.com/opencobra/COBRA.jl/blob/master/test/p\_all.jl https://github.com/opencobra/COBRA.jl/blob/master/src/distributedFBA.jl (from Line 857) D…

---

## [Filterslices or selectslices](https://discourse.julialang.org/t/filterslices-or-selectslices/111746)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 4\
**Last updated:** [March 20, 2024, 11:06am UTC](https://discourse.julialang.org/t/filterslices-or-selectslices/111746 "2024-03-20T11:06:11Z")

</div>

Are there functions like filterslices or selectslices to do the below. X =\[ 1 1 1 1 1 missing 1 1 1 missing missing 1 1 1 1 missing \] i = maps…

---

## [Difference in microbenchmark result, Chairmarks.jl vs BenchmarkTools.jl](https://discourse.julialang.org/t/difference-in-microbenchmark-result-chairmarks-jl-vs-benchmarktools-jl/111656)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 8\
**Last updated:** [March 20, 2024, 11:03am UTC](https://discourse.julialang.org/t/difference-in-microbenchmark-result-chairmarks-jl-vs-benchmarktools-jl/111656 "2024-03-20T11:03:40Z")

</div>

Hi all. I am using BenchmarkTools.jl and Chairmarks.jl to compare the performance of the following (hopefully) mathematically equivalent expressions, to see if they are computationally equivalent. The results are as foll…

---

## [Iterating an action over fields of tuples with similar structure](https://discourse.julialang.org/t/iterating-an-action-over-fields-of-tuples-with-similar-structure/111806)

<div class="topic-metadata">

**Author:** [@Gravlax](https://discourse.julialang.org/u/Gravlax)\
**Replies:** 4\
**Last updated:** [March 20, 2024, 10:56am UTC](https://discourse.julialang.org/t/iterating-an-action-over-fields-of-tuples-with-similar-structure/111806 "2024-03-20T10:56:41Z")

</div>

Dear all, I’m trying to find a way to repeat an operation over the fields of tuples, which have consistent size. For example, let’s consider the sum A = B + C, but applied to each field of a tuple. let size1 = (10…

---

## [Prototype Julia Launcher via Zig](https://discourse.julialang.org/t/prototype-julia-launcher-via-zig/111802)

<div class="topic-metadata">

**Author:** [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Replies:** 9\
**Last updated:** [March 20, 2024, 9:44am UTC](https://discourse.julialang.org/t/prototype-julia-launcher-via-zig/111802 "2024-03-20T09:44:10Z")

</div>

At times, I have just wanted a small executable to launch Julia with some particular command line options and a few initial commands. This task could easily be done by a shell script, but I did not want to depend on a p…

---

## [Determine whether column generation heuristic is optimal?](https://discourse.julialang.org/t/determine-whether-column-generation-heuristic-is-optimal/111857)

<div class="topic-metadata">

**Author:** [@Carl\_Baier](https://discourse.julialang.org/u/Carl_Baier)\
**Replies:** 1\
**Last updated:** [March 20, 2024, 9:22am UTC](https://discourse.julialang.org/t/determine-whether-column-generation-heuristic-is-optimal/111857 "2024-03-20T09:22:51Z")

</div>

Hi, i am currently working on a machine scheduling problem formulated as MILP and trying to solve it with Column Generation. Since I do not use Branch-n-Price, but only Column Generation as heuristic, it can happen that …

---

## [JSON3 to struct, how to improve deserialization performance?](https://discourse.julialang.org/t/json3-to-struct-how-to-improve-deserialization-performance/111667)

<div class="topic-metadata">

**Author:** [@Babiole](https://discourse.julialang.org/u/Babiole)\
**Replies:** 6\
**Last updated:** [March 20, 2024, 8:39am UTC](https://discourse.julialang.org/t/json3-to-struct-how-to-improve-deserialization-performance/111667 "2024-03-20T08:39:55Z")

</div>

Hi, I’m trying to create an application to distribute, this application is loading a JSON configuration file. Since I wanted a one to one binding between the application data and the JSON I’m using the JSON3 package. H…

---

## [HCubature convergence](https://discourse.julialang.org/t/hcubature-convergence/111840)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 3\
**Last updated:** [March 20, 2024, 7:22am UTC](https://discourse.julialang.org/t/hcubature-convergence/111840 "2024-03-20T07:22:29Z")

</div>

I do not understand why HCubature.jl v1.6.0 makes two different estimates of the error E (HCubature.jl/src/HCubature.jl at master · JuliaMath/HCubature.jl · GitHub) for the following two versions of the integrand: using…

---

## [Weird fluctuation in running time](https://discourse.julialang.org/t/weird-fluctuation-in-running-time/111818)

<div class="topic-metadata">

**Author:** [@grero](https://discourse.julialang.org/u/grero)\
**Replies:** 2\
**Last updated:** [March 20, 2024, 1:00am UTC](https://discourse.julialang.org/t/weird-fluctuation-in-running-time/111818 "2024-03-20T01:00:08Z")

</div>

I’ve been observing a weird behaviour with a piece of code I’ve been working on. The running time, as returned by BenchmarkTools, will suddenly jump from around 60ms to over a minute. Once that happens, the running time …

---

## [Strings between fields in struct: Why a valid code](https://discourse.julialang.org/t/strings-between-fields-in-struct-why-a-valid-code/111846)

<div class="topic-metadata">

**Author:** [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Replies:** 4\
**Last updated:** [March 19, 2024, 11:05pm UTC](https://discourse.julialang.org/t/strings-between-fields-in-struct-why-a-valid-code/111846 "2024-03-19T23:05:30Z")

</div>

In the source of the package SimpleArgParse.jl, the definition of mutable struct ArgumentParser contains field definitions intersperses by strings like the following: struct Foo "x value" x::Int "x name" …

---

## [Losing bytes when reinterpreting](https://discourse.julialang.org/t/losing-bytes-when-reinterpreting/111842)

<div class="topic-metadata">

**Author:** [@ion](https://discourse.julialang.org/u/ion)\
**Replies:** 7\
**Last updated:** [March 19, 2024, 11:09pm UTC](https://discourse.julialang.org/t/losing-bytes-when-reinterpreting/111842 "2024-03-19T23:09:55Z")

</div>

Hi all, I am trying to get data over to C, and I went with a ccall that takes in a buffer from julia. The issue I am having is, the data at teh end of my struct is getting chopped off. @kwdef struct CntlOutput time\_…

---

## [Best-effort deserialize a \`.jls\` file](https://discourse.julialang.org/t/best-effort-deserialize-a-jls-file/111845)

<div class="topic-metadata">

**Author:** [@goretkin](https://discourse.julialang.org/u/goretkin)\
**Replies:** 0\
**Last updated:** [March 19, 2024, 9:57pm UTC](https://discourse.julialang.org/t/best-effort-deserialize-a-jls-file/111845 "2024-03-19T21:57:44Z")

</div>

I am trying a workaround for precompiling code that is used via PythonCall.jl, involving serializing many method instances in one pass, and precompiling them in another, and serializing the MethodInstance values in betwe…

---

## [Using \`HomotopyContinuation.jl\` to find the roots of systems that include sin and cosine functions?](https://discourse.julialang.org/t/using-homotopycontinuation-jl-to-find-the-roots-of-systems-that-include-sin-and-cosine-functions/111799)

<div class="topic-metadata">

**Author:** [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Replies:** 0\
**Last updated:** [March 19, 2024, 4:32am UTC](https://discourse.julialang.org/t/using-homotopycontinuation-jl-to-find-the-roots-of-systems-that-include-sin-and-cosine-functions/111799 "2024-03-19T04:32:17Z")

</div>

I am new to Homotopy continuation methods, but I understand the basics. While HC was designed for finding the roots of systems of polynomial equations, I was wondering in the method can be used to find the roots of a sys…

---

## [Compilation time of Flux models](https://discourse.julialang.org/t/compilation-time-of-flux-models/110895)

<div class="topic-metadata">

**Author:** [@cirobr](https://discourse.julialang.org/u/cirobr)\
**Replies:** 9\
**Last updated:** [March 19, 2024, 4:54pm UTC](https://discourse.julialang.org/t/compilation-time-of-flux-models/110895 "2024-03-19T16:54:11Z")

</div>

Cheers, I am struggling to pinpoint why a certain FCN with less than 1M parameters trains much slower than another one with 30M parameters. Then, I realized that, on every epoch, the train loop showed up around 90% of t…

---

## [Fastest way to fetch an index](https://discourse.julialang.org/t/fastest-way-to-fetch-an-index/111725)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 29\
**Last updated:** [March 19, 2024, 4:32pm UTC](https://discourse.julialang.org/t/fastest-way-to-fetch-an-index/111725 "2024-03-19T16:32:55Z")

</div>

~50% of my compute time ends up fetching the right index to index into a sorted array of floats with another float. At first I used findfirst, but this is the best I got for the moment: fetch(vec,x) = vec\[sum(y -\> y \<=…

---

## [Interpolating variable to expr to be used in macro](https://discourse.julialang.org/t/interpolating-variable-to-expr-to-be-used-in-macro/111785)

<div class="topic-metadata">

**Author:** [@co1emi11er](https://discourse.julialang.org/u/co1emi11er)\
**Replies:** 9\
**Last updated:** [March 19, 2024, 2:52pm UTC](https://discourse.julialang.org/t/interpolating-variable-to-expr-to-be-used-in-macro/111785 "2024-03-19T14:52:21Z")

</div>

I want to write a macro that calls 2 macros. The second macro depends on the first macro. The first macro returns an expression that I want to pass to the second macro and I am unsure how to do this. See a simplified exa…

---

## [Macro to generate structs with different parameterized types](https://discourse.julialang.org/t/macro-to-generate-structs-with-different-parameterized-types/111815)

<div class="topic-metadata">

**Author:** [@prittjam](https://discourse.julialang.org/u/prittjam)\
**Replies:** 0\
**Last updated:** [March 19, 2024, 10:52am UTC](https://discourse.julialang.org/t/macro-to-generate-structs-with-different-parameterized-types/111815 "2024-03-19T10:52:11Z")

</div>

I’m writing a macro to generate structs. I would like to substitute different parameterized types as a structure element. How can I achieve this? Below is the example code that does not work: for (Tp, matTp) in ((:Trans…

---

## [How to export all the names of a package that is used in a package in development?](https://discourse.julialang.org/t/how-to-export-all-the-names-of-a-package-that-is-used-in-a-package-in-development/111797)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 2\
**Last updated:** [March 19, 2024, 5:28am UTC](https://discourse.julialang.org/t/how-to-export-all-the-names-of-a-package-that-is-used-in-a-package-in-development/111797 "2024-03-19T05:28:40Z")

</div>

For example, I am developing a new package called PkgB and PkgA is used in it. I want to export all the names form PkgA to the outside of PkgB so that the users of PkgB can directly invoke the names from PkgA without usi…

---

## [Allow for auto-scaling of image in Gtk4](https://discourse.julialang.org/t/allow-for-auto-scaling-of-image-in-gtk4/111624)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 3\
**Last updated:** [March 18, 2024, 11:04pm UTC](https://discourse.julialang.org/t/allow-for-auto-scaling-of-image-in-gtk4/111624 "2024-03-18T23:04:15Z")

</div>

In the following MWE, we can resize the window and the contained image fills out the space accordingly (while retaining the aspect ratio): using Gtk4, GtkObservables using Colors win = GtkWindow("Example") h = 100 c = …

---

## [Vector rotation using CoordinateTransformations.jl](https://discourse.julialang.org/t/vector-rotation-using-coordinatetransformations-jl/111792)

<div class="topic-metadata">

**Author:** [@KajWiik](https://discourse.julialang.org/u/KajWiik)\
**Replies:** 2\
**Last updated:** [March 18, 2024, 10:35pm UTC](https://discourse.julialang.org/t/vector-rotation-using-coordinatetransformations-jl/111792 "2024-03-18T22:35:15Z")

</div>

It looks like vector rotation does not work or I am missing something: using CoordinateTransformations, Rotations, StaticArrays, AngleBetweenVectors julia\> vec = \[1.0,2.0,3.0\] 3-element Vector{Float64}: 1.0 2.0 3.0 …

---

## [PkgManager.jl for dev package management](https://discourse.julialang.org/t/pkgmanager-jl-for-dev-package-management/111776)

<div class="topic-metadata">

**Author:** [@Marcell\_Havlik](https://discourse.julialang.org/u/Marcell_Havlik)\
**Replies:** 5\
**Last updated:** [March 18, 2024, 8:51pm UTC](https://discourse.julialang.org/t/pkgmanager-jl-for-dev-package-management/111776 "2024-03-18T20:51:42Z")

</div>

Hey Julianners, I often faced with a problem like this: ERROR: LoadError: ArgumentError: Package BinanceAPI does not have RateLimiter in its dependencies: - You may have a partially installed environment. Try \`Pkg.inst…

---

## ['Initial condition incompatible' error w/ DifferentialEquations.jl](https://discourse.julialang.org/t/initial-condition-incompatible-error-w-differentialequations-jl/111146)

<div class="topic-metadata">

**Author:** [@sharmaviven1](https://discourse.julialang.org/u/sharmaviven1)\
**Replies:** 14\
**Last updated:** [March 18, 2024, 7:49pm UTC](https://discourse.julialang.org/t/initial-condition-incompatible-error-w-differentialequations-jl/111146 "2024-03-18T19:49:36Z")

</div>

Hello all, I am trying to solve a stiff ODE using DifferentialEquations.jl and am running into an error that says Initial condition incompatible with functional form. Here is the equation I am trying to solve: Here…

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

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