# General Usage

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

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

**Page:** 551

---

## [@test\_throws make it difficult to debug unexpected exceptions](https://discourse.julialang.org/t/test-throws-make-it-difficult-to-debug-unexpected-exceptions/67698)

<div class="topic-metadata">

**Author:** [@Mark\_Nahabedian](https://discourse.julialang.org/u/Mark_Nahabedian)\
**Replies:** 0\
**Last updated:** [September 4, 2021, 4:16pm UTC](https://discourse.julialang.org/t/test-throws-make-it-difficult-to-debug-unexpected-exceptions/67698 "2021-09-04T16:16:42Z")

</div>

I’m using @test\_throws in a unit test to verify that the case being tested throws an expected exception. When that code throws a dipperent exception the test fails without giving a stack trace. It seems to me that if a…

---

## [Way to get string representation of an Expression?](https://discourse.julialang.org/t/way-to-get-string-representation-of-an-expression/7778)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 6\
**Last updated:** [September 4, 2021, 2:04pm UTC](https://discourse.julialang.org/t/way-to-get-string-representation-of-an-expression/7778 "2021-09-04T14:04:55Z")

</div>

Let’s say you have a deeply nested Expr node. How do you turn that into a string that could (manually) be copied and pasted into the REPL? edit: related github issue#25121

---

## [RFC: Just In Time Compilation PoC promising 10x dynamic dispatch performance](https://discourse.julialang.org/t/rfc-just-in-time-compilation-poc-promising-10x-dynamic-dispatch-performance/47341)

<div class="topic-metadata">

**Author:** [@tisztamo](https://discourse.julialang.org/u/tisztamo)\
**Replies:** 0\
**Last updated:** [September 26, 2020, 10:33pm UTC](https://discourse.julialang.org/t/rfc-just-in-time-compilation-poc-promising-10x-dynamic-dispatch-performance/47341 "2020-09-26T22:33:08Z")

</div>

edit: There is the fresh new ManualDispatch.jl, a simple manual implementation of the same idea by @jlapeyre This started as a simple benchmark to better understand the performance characteristics of dynamic dispatch, b…

---

## [Why is this FiniteDiff derivative wrong?](https://discourse.julialang.org/t/why-is-this-finitediff-derivative-wrong/67616)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 3\
**Last updated:** [September 4, 2021, 9:13am UTC](https://discourse.julialang.org/t/why-is-this-finitediff-derivative-wrong/67616 "2021-09-04T09:13:47Z")

</div>

What is going on here? using FiniteDiff randmat = rand(10, 2) sto = similar(randmat) function claytonsample!(sto, τ; randmat=randmat) sto .= randmat τ == 0 && return sto n = size(sto, 1) for i in 1:n …

---

## [How to avoid code duplication when defining a function with multiple methods?](https://discourse.julialang.org/t/how-to-avoid-code-duplication-when-defining-a-function-with-multiple-methods/67681)

<div class="topic-metadata">

**Author:** [@Giulio\_Benedetti](https://discourse.julialang.org/u/Giulio_Benedetti)\
**Replies:** 5\
**Last updated:** [September 4, 2021, 9:02am UTC](https://discourse.julialang.org/t/how-to-avoid-code-duplication-when-defining-a-function-with-multiple-methods/67681 "2021-09-04T09:02:44Z")

</div>

Hello! I am writing a long function which can take different numbers and types of arguments, so I am defining multiple methods to tackle each and every case. The function will behave similarly for every case, but there a…

---

## [Are generic types worth the complexity?](https://discourse.julialang.org/t/are-generic-types-worth-the-complexity/67658)

<div class="topic-metadata">

**Author:** [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Replies:** 9\
**Last updated:** [September 4, 2021, 5:40am UTC](https://discourse.julialang.org/t/are-generic-types-worth-the-complexity/67658 "2021-09-04T05:40:00Z")

</div>

When writing methods for a function in my package, I used abstract type declarations for two reasons: Type declarations will ensure a user gets MethodError rather than some other internal error if they use the wrong ty…

---

## [RAM+Swap exhausted while building sys image for Flux activity with PackageCompiler on RaspberryPi3 (Raspbian)](https://discourse.julialang.org/t/ram-swap-exhausted-while-building-sys-image-for-flux-activity-with-packagecompiler-on-raspberrypi3-raspbian/67636)

<div class="topic-metadata">

**Author:** [@Vyacheslav\_Vorobyov](https://discourse.julialang.org/u/Vyacheslav_Vorobyov)\
**Replies:** 4\
**Last updated:** [September 4, 2021, 1:16am UTC](https://discourse.julialang.org/t/ram-swap-exhausted-while-building-sys-image-for-flux-activity-with-packagecompiler-on-raspberrypi3-raspbian/67636 "2021-09-04T01:16:31Z")

</div>

To minimize start time of a Julia(1.6.2) program on RaspberryPI3, I tried to use PackageCompiler to build sys image for some activity done against Flux(only inference, not learn). After an hour of work of PackageCompiler…

---

## [Parametric type signature in methods, any actual difference?](https://discourse.julialang.org/t/parametric-type-signature-in-methods-any-actual-difference/67663)

<div class="topic-metadata">

**Author:** [@albheim](https://discourse.julialang.org/u/albheim)\
**Replies:** 3\
**Last updated:** [September 3, 2021, 9:59pm UTC](https://discourse.julialang.org/t/parametric-type-signature-in-methods-any-actual-difference/67663 "2021-09-03T21:59:45Z")

</div>

Was just curious if there was actually a difference in some way between these two ways of defining a method with parametric types. function f1(x::Vector{\<:Real}) # Stuff end function f2(x::Vector{T}) where T \<: Real…

---

## [Overlay Normal distribution on density or histogram plot](https://discourse.julialang.org/t/overlay-normal-distribution-on-density-or-histogram-plot/67664)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 3\
**Last updated:** [September 3, 2021, 8:32pm UTC](https://discourse.julialang.org/t/overlay-normal-distribution-on-density-or-histogram-plot/67664 "2021-09-03T20:32:24Z")

</div>

I’m trying out Makie and AlgebraOfGraphics. Very cool! I’m wondering how to add a plot of a Normal distribution pdf over my density or histogram layer. For example, how could I add it as a third curve in this particular…

---

## [Syntax of types with "new" in constructors, where is it described?](https://discourse.julialang.org/t/syntax-of-types-with-new-in-constructors-where-is-it-described/67652)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 4\
**Last updated:** [September 3, 2021, 6:37pm UTC](https://discourse.julialang.org/t/syntax-of-types-with-new-in-constructors-where-is-it-described/67652 "2021-09-03T18:37:21Z")

</div>

I ran into the issue described in How to resolve syntax: too few type parameters specified in &ldquo;new{&hellip;}&rdquo;? yesterday and for the life of me I can’t find anywhere in the documentation where the syntax new{…

---

## [Loading individual entries from BSON ignoring all others](https://discourse.julialang.org/t/loading-individual-entries-from-bson-ignoring-all-others/67660)

<div class="topic-metadata">

**Author:** [@crinders](https://discourse.julialang.org/u/crinders)\
**Replies:** 0\
**Last updated:** [September 3, 2021, 5:37pm UTC](https://discourse.julialang.org/t/loading-individual-entries-from-bson-ignoring-all-others/67660 "2021-09-03T17:37:05Z")

</div>

I’ve been using BSON to save my data. I’m using Turing and saved a BNN model. I tried to save the model, but I can’t reload it without explicitly using every dependent package utilized and finally some function for VarNa…

---

## [RCall.jl and Unicode](https://discourse.julialang.org/t/rcall-jl-and-unicode/67654)

<div class="topic-metadata">

**Author:** [@matvil](https://discourse.julialang.org/u/matvil)\
**Replies:** 2\
**Last updated:** [September 3, 2021, 5:33pm UTC](https://discourse.julialang.org/t/rcall-jl-and-unicode/67654 "2021-09-03T17:33:52Z")

</div>

R on Windows does not seem to support unicode (UTF-8), at least not the non-experimental versions. I am currently doing a workaround where I copy all unicode arguments in Julia to ascii before passing them to R via RCal…

---

## [Get types of members of a Tuple{} type](https://discourse.julialang.org/t/get-types-of-members-of-a-tuple-type/67645)

<div class="topic-metadata">

**Author:** [@Mark\_Nahabedian](https://discourse.julialang.org/u/Mark_Nahabedian)\
**Replies:** 7\
**Last updated:** [September 3, 2021, 2:35pm UTC](https://discourse.julialang.org/t/get-types-of-members-of-a-tuple-type/67645 "2021-09-03T14:35:50Z")

</div>

Given a Tuple type Tuple{typeof(DXFutils.parseraction), Parser, DXFGroup, EntityType\_SECTION} how do I extract the types of the 2nd and 3rd elements, to get something like (DXFGroup, EntityType\_SECTION})\` Fieldnames …

---

## [How to create vector of specific structure?](https://discourse.julialang.org/t/how-to-create-vector-of-specific-structure/67606)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 9\
**Last updated:** [September 3, 2021, 1:59pm UTC](https://discourse.julialang.org/t/how-to-create-vector-of-specific-structure/67606 "2021-09-03T13:59:58Z")

</div>

I have this structure: julia\> Base.@kwdef mutable struct Vsines instancename::String="Def" value::Float64=0.0 end and I want to create a vector of “Vsines” instances (name of this vector is…

---

## [How to prevent type conversion for single value array?](https://discourse.julialang.org/t/how-to-prevent-type-conversion-for-single-value-array/67632)

<div class="topic-metadata">

**Author:** [@Minimum-Pollution-96](https://discourse.julialang.org/u/Minimum-Pollution-96)\
**Replies:** 4\
**Last updated:** [September 3, 2021, 1:27pm UTC](https://discourse.julialang.org/t/how-to-prevent-type-conversion-for-single-value-array/67632 "2021-09-03T13:27:26Z")

</div>

I am trying to create a single valued array called xs in which I am later pushing in values. xs = \[x0,\] where x0 is obtained through a slider in Pluto notebook as follows. @bind x0 Slider(0.0:0.01:0.99, show\_value=tru…

---

## [How to use Lyapunov function in Julia](https://discourse.julialang.org/t/how-to-use-lyapunov-function-in-julia/4195)

<div class="topic-metadata">

**Author:** [@ashim-haque](https://discourse.julialang.org/u/ashim-haque)\
**Replies:** 13\
**Last updated:** [September 3, 2021, 12:23pm UTC](https://discourse.julialang.org/t/how-to-use-lyapunov-function-in-julia/4195 "2021-09-03T12:23:30Z")

</div>

Please can anyone guide me how to use the Lyapunov function in julia?

---

## [How to get the name of the current function](https://discourse.julialang.org/t/how-to-get-the-name-of-the-current-function/51223)

<div class="topic-metadata">

**Author:** [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Replies:** 5\
**Last updated:** [September 3, 2021, 10:29am UTC](https://discourse.julialang.org/t/how-to-get-the-name-of-the-current-function/51223 "2021-09-03T10:29:51Z")

</div>

I want to meta-program functions that include messages with their names. This works: fname = :foo @eval $fname() = "This function is \`$(fname)\`" julia\> foo() "This function is \`foo\`" But this doesn’t: for fname in (:…

---

## [Adding multiple agent types to an AgentBasedModel (in Agents.jl)](https://discourse.julialang.org/t/adding-multiple-agent-types-to-an-agentbasedmodel-in-agents-jl/65270)

<div class="topic-metadata">

**Author:** [@imantha](https://discourse.julialang.org/u/imantha)\
**Replies:** 8\
**Last updated:** [September 3, 2021, 9:23am UTC](https://discourse.julialang.org/t/adding-multiple-agent-types-to-an-agentbasedmodel-in-agents-jl/65270 "2021-09-03T09:23:21Z")

</div>

Hi, I am trying create an Agent Based Model using the Agents.jl package and wondering how to add multiple agent types in GridSpace based model. In this instance I want to add two type of agents using Agents:: Abstract…

---

## [Interpolate Dates](https://discourse.julialang.org/t/interpolate-dates/8091)

<div class="topic-metadata">

**Author:** [@anon67531922](https://discourse.julialang.org/u/anon67531922)\
**Replies:** 5\
**Last updated:** [September 3, 2021, 7:29am UTC](https://discourse.julialang.org/t/interpolate-dates/8091 "2021-09-03T07:29:56Z")

</div>

Similar to this, I am interested in writing an interpolation for Date(Times). julia\> using Interpolations julia\> dates = \[Dates.today()+Dates.Year(i-1) for i in 1:6\] 6-element Array{Date,1}: 2018-01-01 2019-01-01 20…

---

## [Slowdown when computing eigenvalues for list of matrices with pmap](https://discourse.julialang.org/t/slowdown-when-computing-eigenvalues-for-list-of-matrices-with-pmap/67622)

<div class="topic-metadata">

**Author:** [@christian-hh](https://discourse.julialang.org/u/christian-hh)\
**Replies:** 2\
**Last updated:** [September 3, 2021, 7:09am UTC](https://discourse.julialang.org/t/slowdown-when-computing-eigenvalues-for-list-of-matrices-with-pmap/67622 "2021-09-03T07:09:57Z")

</div>

I am attempting to compute, in parallel, the eigenvalues for a list of symmetric matrices. In the code below this is achieved with pmap (using 10 workers) and sequentially (for comparison). I’ve set the number of threads…

---

## [Plotting: Log-log plot: How do I resolve a "no strict ticks" warning?](https://discourse.julialang.org/t/plotting-log-log-plot-how-do-i-resolve-a-no-strict-ticks-warning/67510)

<div class="topic-metadata">

**Author:** [@psanan](https://discourse.julialang.org/u/psanan)\
**Replies:** 2\
**Last updated:** [September 3, 2021, 6:18am UTC](https://discourse.julialang.org/t/plotting-log-log-plot-how-do-i-resolve-a-no-strict-ticks-warning/67510 "2021-09-03T06:18:32Z")

</div>

I’d like to plot data, as in the following example, on a log-log plot. Recently (I think since upgrading from 1.5.x to 1.6.2), I’ve noticed “no strict ticks” warnings and no ticks on the x axis. I assume a heuristic for …

---

## [Juno installing issue](https://discourse.julialang.org/t/juno-installing-issue/67626)

<div class="topic-metadata">

**Author:** [@Chaitanya](https://discourse.julialang.org/u/Chaitanya)\
**Replies:** 0\
**Last updated:** [September 3, 2021, 6:15am UTC](https://discourse.julialang.org/t/juno-installing-issue/67626 "2021-09-03T06:15:58Z")

</div>

I am getting this screen while installing uber-juno. i just can type in there. No other button is working! like escape…etc. how do i go further?

---

## [How do I simply express a canonical basis for G4 using Symbolics.jl](https://discourse.julialang.org/t/how-do-i-simply-express-a-canonical-basis-for-g4-using-symbolics-jl/67540)

<div class="topic-metadata">

**Author:** [@banksiaboy](https://discourse.julialang.org/u/banksiaboy)\
**Replies:** 2\
**Last updated:** [September 3, 2021, 4:48am UTC](https://discourse.julialang.org/t/how-do-i-simply-express-a-canonical-basis-for-g4-using-symbolics-jl/67540 "2021-09-03T04:48:05Z")

</div>

I am fumbling my way through learning basic Geometric Algebra. I want to bootstrap my understanding of using Symbolics.jl at the same time. I have some dumb questions about the mathematics, and usage of the Symbolics pac…

---

## [Problem with CSV.jl reading csv file with extra spaces](https://discourse.julialang.org/t/problem-with-csv-jl-reading-csv-file-with-extra-spaces/67546)

<div class="topic-metadata">

**Author:** [@xinchin](https://discourse.julialang.org/u/xinchin)\
**Replies:** 5\
**Last updated:** [September 3, 2021, 3:02am UTC](https://discourse.julialang.org/t/problem-with-csv-jl-reading-csv-file-with-extra-spaces/67546 "2021-09-03T03:02:49Z")

</div>

I’m trying to read a csv file into julia, e.g. a,b,c 1,23,4 1, , 5 by using CSV.File(csvfile, missingstring = " ", types = \[Int, Int, Int\]) but getting this 2-element CSV.File{false}: CSV.Row: (a = 1, b = 23, c = 4…

---

## [Dual-axis plot breaks with multiple variables on right/secondary y-axis](https://discourse.julialang.org/t/dual-axis-plot-breaks-with-multiple-variables-on-right-secondary-y-axis/64491)

<div class="topic-metadata">

**Author:** [@tai](https://discourse.julialang.org/u/tai)\
**Replies:** 5\
**Last updated:** [September 3, 2021, 1:43am UTC](https://discourse.julialang.org/t/dual-axis-plot-breaks-with-multiple-variables-on-right-secondary-y-axis/64491 "2021-09-03T01:43:31Z")

</div>

I’m facing a garbled plot when I do a dual-axis plot with multiple variables on right/secondary y-axis. Here, I’m trying to do multiple lineplots on top of a barplot. using Plots using Plots.PlotMeasures pyplot() bar(r…

---

## [Understanding Shell Interactions within Julia scripts](https://discourse.julialang.org/t/understanding-shell-interactions-within-julia-scripts/67608)

<div class="topic-metadata">

**Author:** [@mwhisena](https://discourse.julialang.org/u/mwhisena)\
**Replies:** 2\
**Last updated:** [September 3, 2021, 12:53am UTC](https://discourse.julialang.org/t/understanding-shell-interactions-within-julia-scripts/67608 "2021-09-03T00:53:25Z")

</div>

Hello! I am a PhD. student hoping to use Julia for some extensive ML CFD data analysis. I am having trouble with shell scope within a Julia script. I need to source (via Linux bash shell) a bashrc file for OpenFOAM (CFD…

---

## [Recursively applied 1D function](https://discourse.julialang.org/t/recursively-applied-1d-function/67602)

<div class="topic-metadata">

**Author:** [@cmdenis](https://discourse.julialang.org/u/cmdenis)\
**Replies:** 3\
**Last updated:** [September 2, 2021, 11:17pm UTC](https://discourse.julialang.org/t/recursively-applied-1d-function/67602 "2021-09-02T23:17:15Z")

</div>

Hello, I am trying to compose the same function with itself n times efficiently. I found a way of doing that using macros, but it gave me a lot of problems when being used within functions and using elements that were n…

---

## [Vector comprehensions hamper type inference?](https://discourse.julialang.org/t/vector-comprehensions-hamper-type-inference/67603)

<div class="topic-metadata">

**Author:** [@droodman](https://discourse.julialang.org/u/droodman)\
**Replies:** 1\
**Last updated:** [September 2, 2021, 10:14pm UTC](https://discourse.julialang.org/t/vector-comprehensions-hamper-type-inference/67603 "2021-09-02T22:14:12Z")

</div>

I’m new to Julia, so I post now with uncertainty. I’m finding that vector comprehensions hamper the compiler’s type inference–both about 1) the type of the result of the comprehension and 2) about the type of arguments p…

---

## [Converting (combined) Pooled DataFrame to Matrix](https://discourse.julialang.org/t/converting-combined-pooled-dataframe-to-matrix/67589)

<div class="topic-metadata">

**Author:** [@compleat](https://discourse.julialang.org/u/compleat)\
**Replies:** 8\
**Last updated:** [September 2, 2021, 8:27pm UTC](https://discourse.julialang.org/t/converting-combined-pooled-dataframe-to-matrix/67589 "2021-09-02T20:27:46Z")

</div>

Searchable documentation suggests that a way to convert a DataFrame to a Matrix is just convert(Matrix,df) Previously, this worked with (combined) Pooled DataFrames but something seems to have changed in a recent upda…

---

## [Request: someone to complete the Julia example in the Wikipedia page on multiple dispatch](https://discourse.julialang.org/t/request-someone-to-complete-the-julia-example-in-the-wikipedia-page-on-multiple-dispatch/67597)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 7\
**Last updated:** [September 2, 2021, 8:26pm UTC](https://discourse.julialang.org/t/request-someone-to-complete-the-julia-example-in-the-wikipedia-page-on-multiple-dispatch/67597 "2021-09-02T20:26:25Z")

</div>

The Wikipedia page on multiple dispatch has a complete exsmple in C#, but then in Julia the same exanple is given only as a sketch… could someone that inferstand C# complete the Julia example ? it would then be nice to c…

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

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