# General Usage

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

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

**Page:** 389

---

## [Minimally promoting division](https://discourse.julialang.org/t/minimally-promoting-division/88127)

<div class="topic-metadata">

**Author:** [@John\_Gibson](https://discourse.julialang.org/u/John_Gibson)\
**Replies:** 4\
**Last updated:** [October 2, 2022, 9:05pm UTC](https://discourse.julialang.org/t/minimally-promoting-division/88127 "2022-10-02T21:05:00Z")

</div>

I could use a division function or operator that did minimal type promotion. E.g. a divide(x,y) function and associated operator that would return a Rational for rational or integer x,y and a floating-point number if ei…

---

## [Canonical way to get a list of all stdibs](https://discourse.julialang.org/t/canonical-way-to-get-a-list-of-all-stdibs/88115)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 5\
**Last updated:** [October 2, 2022, 7:22pm UTC](https://discourse.julialang.org/t/canonical-way-to-get-a-list-of-all-stdibs/88115 "2022-10-02T19:22:33Z")

</div>

What is the best way to get this vector? stdlibs = \[ :ArgTools, :Artifacts, :Base64, :CRC32c, :CompilerSupportLibraries\_jll, :Dates, :Distributed, :Downloads, :FileWatching, :Futu…

---

## [Julia 1.8.\* & VSCode & Ryzen CPU & Windows 10 64bit --\> crash](https://discourse.julialang.org/t/julia-1-8-vscode-ryzen-cpu-windows-10-64bit-crash/87283)

<div class="topic-metadata">

**Author:** [@rryi](https://discourse.julialang.org/u/rryi)\
**Replies:** 5\
**Last updated:** [October 2, 2022, 6:59pm UTC](https://discourse.julialang.org/t/julia-1-8-vscode-ryzen-cpu-windows-10-64bit-crash/87283 "2022-10-02T18:59:12Z")

</div>

I used julia and VSCode with many julia versions without problems, but since julia 1.8.0, I get severe crashes when installing and starting the VSCode julia extension on windows PCs with an AMD Ryzen CPU… I verified it w…

---

## [Scale is not defined](https://discourse.julialang.org/t/scale-is-not-defined/88102)

<div class="topic-metadata">

**Author:** [@m\_shah2](https://discourse.julialang.org/u/m_shah2)\
**Replies:** 9\
**Last updated:** [October 2, 2022, 6:40pm UTC](https://discourse.julialang.org/t/scale-is-not-defined/88102 "2022-10-02T18:40:01Z")

</div>

UndefVarError: scale not defined Stacktrace: \[1\] spectral\_embedding(W::SparseMatrixCSC{Float64, Int64}, nev::Int64) @ Main .\\In\[45\]:10 \[2\] top-level scope @ In\[48\]:1 \[3\] eval @ .\\boot.jl:368 \[inlined\] \[4\] include…

---

## [How to Plot Direction Field with 4 places of decimal for the y-axis](https://discourse.julialang.org/t/how-to-plot-direction-field-with-4-places-of-decimal-for-the-y-axis/88109)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 1\
**Last updated:** [October 2, 2022, 3:39pm UTC](https://discourse.julialang.org/t/how-to-plot-direction-field-with-4-places-of-decimal-for-the-y-axis/88109 "2022-10-02T15:39:21Z")

</div>

Hi all, I wonder is Julia plotting can’t plot the tickers for y-axis for number with lots of decimals 0.0001 etc. It is only plotting 0.2 0.4 … For the simple differential equation: \\frac{dq}{dt} = 300 ( 0.01 - 10^{…

---

## [Would you accept a compressed number format to replace Float64 and integers if you had to opt into a package?](https://discourse.julialang.org/t/would-you-accept-a-compressed-number-format-to-replace-float64-and-integers-if-you-had-to-opt-into-a-package/88122)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 0\
**Last updated:** [October 2, 2022, 2:01pm UTC](https://discourse.julialang.org/t/would-you-accept-a-compressed-number-format-to-replace-float64-and-integers-if-you-had-to-opt-into-a-package/88122 "2022-10-02T14:01:02Z")

</div>

\[Please don’t move to numerics, at least yet, I would like to know if regular users would use such a package.\] First I want to tell new users like @pppoe5 that Julia already supports checked overflow of integers in a pa…

---

## [Default value of \*some\* fields in a mutable struct](https://discourse.julialang.org/t/default-value-of-some-fields-in-a-mutable-struct/33408)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 24\
**Last updated:** [October 2, 2022, 1:35pm UTC](https://discourse.julialang.org/t/default-value-of-some-fields-in-a-mutable-struct/33408 "2022-10-02T13:35:54Z")

</div>

Hi guys, just a specific question here: I would like to create a data type with several fields, and give a default value to some of them, but not all. But more specifically, I would like to have only this value appear i…

---

## [Local modules](https://discourse.julialang.org/t/local-modules/88117)

<div class="topic-metadata">

**Author:** [@ZuiDet](https://discourse.julialang.org/u/ZuiDet)\
**Replies:** 1\
**Last updated:** [October 2, 2022, 10:22am UTC](https://discourse.julialang.org/t/local-modules/88117 "2022-10-02T10:22:38Z")

</div>

How to work with multiple local linked modules? I have read through the similar topics in discourse but didn’t find a suitable solution. I have one main module which uses 2 modules: ModA and helper. Module modA also us…

---

## [Best input/output format for Julia ML packages](https://discourse.julialang.org/t/best-input-output-format-for-julia-ml-packages/88078)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 8\
**Last updated:** [October 1, 2022, 10:19pm UTC](https://discourse.julialang.org/t/best-input-output-format-for-julia-ml-packages/88078 "2022-10-01T22:19:15Z")

</div>

Following a recent discussion on slack, I’d like to raise this point here on discourse for arguments not to disappear. Also, the slack format with many short messages isn’t the most convenient for longer discussions. Cu…

---

## [Can you call Julia methods with LLVM call?](https://discourse.julialang.org/t/can-you-call-julia-methods-with-llvm-call/31082)

<div class="topic-metadata">

**Author:** [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Replies:** 15\
**Last updated:** [October 1, 2022, 9:13pm UTC](https://discourse.julialang.org/t/can-you-call-julia-methods-with-llvm-call/31082 "2022-10-01T21:13:26Z")

</div>

Is there a way to call Julia methods with llvmcall in a way transparent to the optimizer, so that these methods can be inlined, etc? Defining julia\> foo(a,b,c) = sin(a \* b + c) foo (generic function with 1 method) Each…

---

## [Static variable in a templated function or struct](https://discourse.julialang.org/t/static-variable-in-a-templated-function-or-struct/88093)

<div class="topic-metadata">

**Author:** [@DerongXu](https://discourse.julialang.org/u/DerongXu)\
**Replies:** 1\
**Last updated:** [October 1, 2022, 6:15pm UTC](https://discourse.julialang.org/t/static-variable-in-a-templated-function-or-struct/88093 "2022-10-01T18:15:39Z")

</div>

There are a lot of discussions to emulate local static variable in Julia. One is to use let block, let a = 0 global function f() a += 1 end end However, it is not work…

---

## [Nelder Mead tolerance vastly higher when I restart optimization with updated guess for initial parameters](https://discourse.julialang.org/t/nelder-mead-tolerance-vastly-higher-when-i-restart-optimization-with-updated-guess-for-initial-parameters/87939)

<div class="topic-metadata">

**Author:** [@structural](https://discourse.julialang.org/u/structural)\
**Replies:** 20\
**Last updated:** [October 1, 2022, 3:32pm UTC](https://discourse.julialang.org/t/nelder-mead-tolerance-vastly-higher-when-i-restart-optimization-with-updated-guess-for-initial-parameters/87939 "2022-10-01T15:32:40Z")

</div>

Is it normal for the tolerance to jump when you restart Optim with the parameters initialized to equal the parameters from the last iteration of the last Optim call? I am minimizing some function f(b, x) using Nelder-Me…

---

## [Initialize an array (or other structure), add](https://discourse.julialang.org/t/initialize-an-array-or-other-structure-add/88064)

<div class="topic-metadata">

**Author:** [@ejlongman](https://discourse.julialang.org/u/ejlongman)\
**Replies:** 4\
**Last updated:** [October 1, 2022, 12:05pm UTC](https://discourse.julialang.org/t/initialize-an-array-or-other-structure-add/88064 "2022-10-01T12:05:03Z")

</div>

I’m looking to create something like this: array = \[(0,0) (0,0) ;(0,0) (0,0) ; (0,0) (0,0)\] To store the results of a loop where the first iteration returns an array of pairs that I use to overwrite column 1 \[(m,n); (…

---

## [Filtering list from a list](https://discourse.julialang.org/t/filtering-list-from-a-list/88074)

<div class="topic-metadata">

**Author:** [@Phuntsho](https://discourse.julialang.org/u/Phuntsho)\
**Replies:** 4\
**Last updated:** [October 1, 2022, 11:59am UTC](https://discourse.julialang.org/t/filtering-list-from-a-list/88074 "2022-10-01T11:59:26Z")

</div>

I have two lists: one containing a list of tuples (numbers) and the other the list of numbers. For instance, L = \[(2,3),(5,6), (4,6),…\] and E = \[2,5,7,3…\]. Now, are there any other better ways to do similar to the follow…

---

## [Recreate a random number series when not using Random.seed!(my\_seed)](https://discourse.julialang.org/t/recreate-a-random-number-series-when-not-using-random-seed-my-seed/88038)

<div class="topic-metadata">

**Author:** [@ArchieCall](https://discourse.julialang.org/u/ArchieCall)\
**Replies:** 12\
**Last updated:** [October 1, 2022, 9:45am UTC](https://discourse.julialang.org/t/recreate-a-random-number-series-when-not-using-random-seed-my-seed/88038 "2022-10-01T09:45:11Z")

</div>

Is there a way to get back a random number series when Random.seed!(my\_seed) was not used to create the series. One thought I had was to randomly generate my\_seed and then use that to gen the series in the Random.seed! …

---

## [Relation of coroutines, threads, and Tasks](https://discourse.julialang.org/t/relation-of-coroutines-threads-and-tasks/87735)

<div class="topic-metadata">

**Author:** [@Ross\_Boylan](https://discourse.julialang.org/u/Ross_Boylan)\
**Replies:** 4\
**Last updated:** [October 1, 2022, 7:35am UTC](https://discourse.julialang.org/t/relation-of-coroutines-threads-and-tasks/87735 "2022-10-01T07:35:04Z")

</div>

A simple version of my question is “How can Tasks and Channels, which are coroutine-related, be used safely with threads?” The “how” here is more in these sense of “how is it possible” than “how do I code it”, since the…

---

## [How to appreciate Expr(:meta, args...)](https://discourse.julialang.org/t/how-to-appreciate-expr-meta-args/88071)

<div class="topic-metadata">

**Author:** [@lionisxn](https://discourse.julialang.org/u/lionisxn)\
**Replies:** 2\
**Last updated:** [October 1, 2022, 7:14am UTC](https://discourse.julialang.org/t/how-to-appreciate-expr-meta-args/88071 "2022-10-01T07:14:55Z")

</div>

The Julia domment exlaining the Expr type of ‘:meta’ is so concise to a newer like me. What is the manning of Expr(:meta, args…), and how to use it? Simple examples may be helpfull.

---

## [Distributed worker detect ip address via socket connection?](https://discourse.julialang.org/t/distributed-worker-detect-ip-address-via-socket-connection/88068)

<div class="topic-metadata">

**Author:** [@jling](https://discourse.julialang.org/u/jling)\
**Replies:** 1\
**Last updated:** [October 1, 2022, 3:27am UTC](https://discourse.julialang.org/t/distributed-worker-detect-ip-address-via-socket-connection/88068 "2022-10-01T03:27:25Z")

</div>

Right now there’s this kinda dumb logic going on: submit jobs for worker nodes to launch julia --worker=\<cookie\> | nc \<hostip\> \<hostport\> the julia --worker=\<cookie\> would print out the julia\_worker:workerport#worker…

---

## [Immediately executing closure as function barrier](https://discourse.julialang.org/t/immediately-executing-closure-as-function-barrier/87976)

<div class="topic-metadata">

**Author:** [@torrance](https://discourse.julialang.org/u/torrance)\
**Replies:** 16\
**Last updated:** [September 30, 2022, 10:08pm UTC](https://discourse.julialang.org/t/immediately-executing-closure-as-function-barrier/87976 "2022-09-30T22:08:50Z")

</div>

It’s common for code to do a bunch of allocations up front, that may or may not be type stable, and then call out to another function to do some actual work with those allocations. This ‘function barrier’ enables the ker…

---

## [Solve Simultaneous Algebraic Equations (x eqns and x unknowns)](https://discourse.julialang.org/t/solve-simultaneous-algebraic-equations-x-eqns-and-x-unknowns/88060)

<div class="topic-metadata">

**Author:** [@rwalters31](https://discourse.julialang.org/u/rwalters31)\
**Replies:** 2\
**Last updated:** [October 1, 2022, 1:55am UTC](https://discourse.julialang.org/t/solve-simultaneous-algebraic-equations-x-eqns-and-x-unknowns/88060 "2022-10-01T01:55:01Z")

</div>

I have been looking for a Julia package to solve simultaneous algebraic equations. A simple example for two equations and two unknowns might look like: x^{2}+y^{2}=5 y=\\frac{1}{2}x^{3}+3x^{2}-2x-3 Here is a plot of…

---

## [Surprising type inference failure for \`map\` on mid-size tuples](https://discourse.julialang.org/t/surprising-type-inference-failure-for-map-on-mid-size-tuples/88057)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 1\
**Last updated:** [September 30, 2022, 10:48pm UTC](https://discourse.julialang.org/t/surprising-type-inference-failure-for-map-on-mid-size-tuples/88057 "2022-09-30T22:48:59Z")

</div>

This surprised me: using Test # for Test.@inferred g(::Val{n}) where {n} = ntuple(i -\> one(Rational{BigInt}), Val{n}()) # constructs an example tuple of specified length map(+, g(Val{30}()), g(Val{30}())); # warm up …

---

## [Derivatives of B-Spline w.r.t their degrees of freedom](https://discourse.julialang.org/t/derivatives-of-b-spline-w-r-t-their-degrees-of-freedom/87997)

<div class="topic-metadata">

**Author:** [@touste](https://discourse.julialang.org/u/touste)\
**Replies:** 3\
**Last updated:** [September 30, 2022, 9:25pm UTC](https://discourse.julialang.org/t/derivatives-of-b-spline-w-r-t-their-degrees-of-freedom/87997 "2022-09-30T21:25:31Z")

</div>

Hi all, I’m trying to approximate a shape described by a set of 3D points with a smooth interpolant, I’ve settled on a parametric B-Spline. I’ve got a set of 3D points P\_i: using GeometryBasics P₁ = Point3(0.0, 0.0, 0…

---

## [Extract from a cartesian index](https://discourse.julialang.org/t/extract-from-a-cartesian-index/88062)

<div class="topic-metadata">

**Author:** [@ejlongman](https://discourse.julialang.org/u/ejlongman)\
**Replies:** 1\
**Last updated:** [September 30, 2022, 9:04pm UTC](https://discourse.julialang.org/t/extract-from-a-cartesian-index/88062 "2022-09-30T21:04:12Z")

</div>

Hello! I am looking to extract the coordinates from this array of cartesian indexes in the lokmax vector. lokmax = vec(findmax(bellman,dims=1)\[2\]) resulting in CartesianIndex{2}\[CartesianIndex(3, 1), CartesianIndex(…

---

## [Pure Julia HINT benchmark](https://discourse.julialang.org/t/pure-julia-hint-benchmark/88055)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 0\
**Last updated:** [September 30, 2022, 8:04pm UTC](https://discourse.julialang.org/t/pure-julia-hint-benchmark/88055 "2022-09-30T20:04:31Z")

</div>

Back in the day John Gustafson and friends invented a really great benchmark called HINT (Hierarchical INTegration). It measures quality improvements per second (quips) as a function of memory used… So produces a curve …

---

## [Best way to convert/collect/promote into a concrete struct?](https://discourse.julialang.org/t/best-way-to-convert-collect-promote-into-a-concrete-struct/87953)

<div class="topic-metadata">

**Author:** [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Replies:** 5\
**Last updated:** [September 30, 2022, 7:24pm UTC](https://discourse.julialang.org/t/best-way-to-convert-collect-promote-into-a-concrete-struct/87953 "2022-09-30T19:24:18Z")

</div>

I have the struct below that I am trying to make more flexible: struct PolyFit x::Vector{Float64} y::Vector{Float64} knots::Vector{Int64} segmentlengths::Vector{Float64} polys::Vector{Polynomial{Floa…

---

## [How do you preform multiple actions in a thread safe way?](https://discourse.julialang.org/t/how-do-you-preform-multiple-actions-in-a-thread-safe-way/88049)

<div class="topic-metadata">

**Author:** [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Replies:** 2\
**Last updated:** [September 30, 2022, 5:50pm UTC](https://discourse.julialang.org/t/how-do-you-preform-multiple-actions-in-a-thread-safe-way/88049 "2022-09-30T17:50:31Z")

</div>

I need to check the sums of different combinations from a matrix, and get the biggest sum out. There are 20! combinations. I need to thread safely check if the loop’s current sum is bigger than the current sum and if it …

---

## [Italic string in a plot, how?](https://discourse.julialang.org/t/italic-string-in-a-plot-how/88036)

<div class="topic-metadata">

**Author:** [@fdamore](https://discourse.julialang.org/u/fdamore)\
**Replies:** 6\
**Last updated:** [September 30, 2022, 5:04pm UTC](https://discourse.julialang.org/t/italic-string-in-a-plot-how/88036 "2022-09-30T17:04:55Z")

</div>

Hi, I’m trying to create a plot with Plots: without using Latex, how can one make an italic label for the axes? Thanks!

---

## [Julia startup speed cut in half. Was: (Unofficial) Julia 1.9 for lower latency (startup)](https://discourse.julialang.org/t/julia-startup-speed-cut-in-half-was-unofficial-julia-1-9-for-lower-latency-startup/83338)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 17\
**Last updated:** [September 30, 2022, 3:15pm UTC](https://discourse.julialang.org/t/julia-startup-speed-cut-in-half-was-unofficial-julia-1-9-for-lower-latency-startup/83338 "2022-09-30T15:15:40Z")

</div>

The timing for (not unofficial) 1.9 master shows 7.6% faster startup than for Julia 1.7.0: $ hyperfine '~/Downloads/julia-a60c76ea57/bin/julia -e ""' Benchmark 1: ~/Downloads/julia-a60c76ea57/bin/julia -e "" Time (mea…

---

## [Methods imported from submodules are overwritten, not extended](https://discourse.julialang.org/t/methods-imported-from-submodules-are-overwritten-not-extended/87995)

<div class="topic-metadata">

**Author:** [@tom-plaa](https://discourse.julialang.org/u/tom-plaa)\
**Replies:** 3\
**Last updated:** [September 30, 2022, 2:00pm UTC](https://discourse.julialang.org/t/methods-imported-from-submodules-are-overwritten-not-extended/87995 "2022-09-30T14:00:06Z")

</div>

I assumed that by defining different argument requirements I would get different methods for an already imported function from a submodule, but it seems I am getting an overwrite instead of an extension. What’s the idiom…

---

## [Standard color sequence in Makie](https://discourse.julialang.org/t/standard-color-sequence-in-makie/88027)

<div class="topic-metadata">

**Author:** [@mschauer](https://discourse.julialang.org/u/mschauer)\
**Replies:** 1\
**Last updated:** [September 30, 2022, 1:49pm UTC](https://discourse.julialang.org/t/standard-color-sequence-in-makie/88027 "2022-09-30T13:49:28Z")

</div>

I want to cycle through the colors of the standard color sequence for different lines in a line plot (mostly because I want to draw a line and a dotted line in the same color for a couple of line pairs.)

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

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