# General Usage

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

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

**Page:** 395

---

## [Questions about missing](https://discourse.julialang.org/t/questions-about-missing/87545)

<div class="topic-metadata">

**Author:** [@zhangchunyong](https://discourse.julialang.org/u/zhangchunyong)\
**Replies:** 2\
**Last updated:** [September 21, 2022, 7:45am UTC](https://discourse.julialang.org/t/questions-about-missing/87545 "2022-09-21T07:45:10Z")

</div>

julia\> a=\[true,false,true,true,missing\] 5-element Vector{Union{Missing, Bool}}: true false true true missing julia\> mean(skipmissing(a)) 0.75 julia\> length(a) 5 julia\> length(skipmissing(a)) ERROR: MethodErr…

---

## [How to match performance of sum(A, dims=1)?](https://discourse.julialang.org/t/how-to-match-performance-of-sum-a-dims-1/87543)

<div class="topic-metadata">

**Author:** [@torrance](https://discourse.julialang.org/u/torrance)\
**Replies:** 14\
**Last updated:** [September 21, 2022, 6:25am UTC](https://discourse.julialang.org/t/how-to-match-performance-of-sum-a-dims-1/87543 "2022-09-21T06:25:50Z")

</div>

Well, this is a bit embarrassing… I’m writing up a set of slides to present to colleagues about Julia, and I wanted to show an example how explicit looping and so on is fine and dandy and as fast as any other language co…

---

## [Help me: function in Julia](https://discourse.julialang.org/t/help-me-function-in-julia/87523)

<div class="topic-metadata">

**Author:** [@tryjulia](https://discourse.julialang.org/u/tryjulia)\
**Replies:** 8\
**Last updated:** [September 21, 2022, 2:57am UTC](https://discourse.julialang.org/t/help-me-function-in-julia/87523 "2022-09-21T02:57:14Z")

</div>

Hi, so I actually want to write a code that would show me the result of factorial of: x = x + 2 y = x\*(x-1) \* y but when I tried to put it in function, it doesn’t behave the way I want to. It needs to define the x and…

---

## [Julia unresponsive (Apple Silicon issue?)](https://discourse.julialang.org/t/julia-unresponsive-apple-silicon-issue/87484)

<div class="topic-metadata">

**Author:** [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Replies:** 6\
**Last updated:** [September 21, 2022, 12:01am UTC](https://discourse.julialang.org/t/julia-unresponsive-apple-silicon-issue/87484 "2022-09-21T00:01:11Z")

</div>

I have a recurring problem where a long-running process hangs after some time. Screen updating then stops and Ctrl-C or Ctrl-D no longer interrupt the code. I have to restart iterm to stop execution. This happens after …

---

## [Parallelization way](https://discourse.julialang.org/t/parallelization-way/87536)

<div class="topic-metadata">

**Author:** [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Replies:** 2\
**Last updated:** [September 20, 2022, 10:32pm UTC](https://discourse.julialang.org/t/parallelization-way/87536 "2022-09-20T22:32:34Z")

</div>

Hello, please help to parallelize the task, maybe with CUDA? There are two point clouds A and B, the clouds have a different number of points. In cloud A there can be several Y along the X axis, In cloud B, there is o…

---

## [Nth (univariate) derivative using AD](https://discourse.julialang.org/t/nth-univariate-derivative-using-ad/87504)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 5\
**Last updated:** [September 20, 2022, 9:24pm UTC](https://discourse.julialang.org/t/nth-univariate-derivative-using-ad/87504 "2022-09-20T21:24:58Z")

</div>

I need an n th derivative of a univariate function for testing purposes. I came up with import ForwardDiff function ddn(f, x, ::Val{N}) where {N} fn = foldl((f, \_) -\> x -\> ForwardDiff.derivative(f, x), …

---

## [Understanding @turbo behavior to use it right](https://discourse.julialang.org/t/understanding-turbo-behavior-to-use-it-right/87465)

<div class="topic-metadata">

**Author:** [@Sagar\_123](https://discourse.julialang.org/u/Sagar_123)\
**Replies:** 15\
**Last updated:** [September 20, 2022, 6:10pm UTC](https://discourse.julialang.org/t/understanding-turbo-behavior-to-use-it-right/87465 "2022-09-20T18:10:03Z")

</div>

s = ones(5) t = 2\*ones(Int8,5) @turbo for i = 1:5 a = t\[i\] s\[a\] += t\[i\] end Above code gives the values of s vector as \[1.0, 3.0, 1.0, 1.0, 1.0\]. If I remove the macro @turbo, I get the correct result, \[1.0, 11…

---

## [Super title in Plots and subplots](https://discourse.julialang.org/t/super-title-in-plots-and-subplots/29865)

<div class="topic-metadata">

**Author:** [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Replies:** 12\
**Last updated:** [September 20, 2022, 5:43pm UTC](https://discourse.julialang.org/t/super-title-in-plots-and-subplots/29865 "2022-09-20T17:43:47Z")

</div>

Hi, I am having a hard time understanding how to organize titles in Plots.jl using pyplot(). I have 2X2 subplots and I would like to have a title for each subplot, one for each horizontal pair, and one for the overall …

---

## [Optimizing a 2D masked mean](https://discourse.julialang.org/t/optimizing-a-2d-masked-mean/87455)

<div class="topic-metadata">

**Author:** [@kiranshila](https://discourse.julialang.org/u/kiranshila)\
**Replies:** 10\
**Last updated:** [September 20, 2022, 4:30pm UTC](https://discourse.julialang.org/t/optimizing-a-2d-masked-mean/87455 "2022-09-20T16:30:48Z")

</div>

Hey everyone! I’m working on a small package to be used as RFI mitigation in a radio telescope, and I’m getting a little stuck optimizing a small piece of the code. Specifically, I need to be able to take the mean down …

---

## [Ifelse() evalutes both cases](https://discourse.julialang.org/t/ifelse-evalutes-both-cases/87525)

<div class="topic-metadata">

**Author:** [@kucuksen](https://discourse.julialang.org/u/kucuksen)\
**Replies:** 3\
**Last updated:** [September 20, 2022, 3:35pm UTC](https://discourse.julialang.org/t/ifelse-evalutes-both-cases/87525 "2022-09-20T15:35:24Z")

</div>

I have encountered an unexpected (for myself) behavior of the ifelse() function. I thought that it would be easier to read if I used ifelse() function instead of an if-block. To see the problem that I had consider the f…

---

## [Vectorize but break early?](https://discourse.julialang.org/t/vectorize-but-break-early/87362)

<div class="topic-metadata">

**Author:** [@abulak](https://discourse.julialang.org/u/abulak)\
**Replies:** 3\
**Last updated:** [September 20, 2022, 3:10pm UTC](https://discourse.julialang.org/t/vectorize-but-break-early/87362 "2022-09-20T15:10:14Z")

</div>

I’d like to properly vectorize this: """ issuffix(u, v) Check if \`u\` is a suffix of \`v\` """ function issuffix(u::AbstractVector, v::AbstractVector) lu = length(u) lu ≤ length(v) || return false @inbounds…

---

## [Porting Python Global-Chem Knowledge Graph into Julia](https://discourse.julialang.org/t/porting-python-global-chem-knowledge-graph-into-julia/87475)

<div class="topic-metadata">

**Author:** [@Sulstice](https://discourse.julialang.org/u/Sulstice)\
**Replies:** 6\
**Last updated:** [September 20, 2022, 3:06pm UTC](https://discourse.julialang.org/t/porting-python-global-chem-knowledge-graph-into-julia/87475 "2022-09-20T15:06:06Z")

</div>

Hi Y’all, My name is Sul and I am a PhD Student at the University of Maryland, Baltimore. We are writing the molecules to common chemical names that the general public use and keeping a record for all of us to download …

---

## [Javis collision detection](https://discourse.julialang.org/t/javis-collision-detection/87398)

<div class="topic-metadata">

**Author:** [@DoktorMike](https://discourse.julialang.org/u/DoktorMike)\
**Replies:** 11\
**Last updated:** [September 20, 2022, 1:30pm UTC](https://discourse.julialang.org/t/javis-collision-detection/87398 "2022-09-20T13:30:39Z")

</div>

So I’m using the excellent package Javis.jl where I’m making a small simulation to teach my kids about entropy. Basically I want a box with a number of of balls bouncing around in it. I want to be able to detect when the…

---

## [Extracting elements from pmap using for loop](https://discourse.julialang.org/t/extracting-elements-from-pmap-using-for-loop/87516)

<div class="topic-metadata">

**Author:** [@mb96](https://discourse.julialang.org/u/mb96)\
**Replies:** 0\
**Last updated:** [September 20, 2022, 12:48pm UTC](https://discourse.julialang.org/t/extracting-elements-from-pmap-using-for-loop/87516 "2022-09-20T12:48:49Z")

</div>

I am confused about Julia behavior when I used pmap return object as an iterator. I will first show a chunk of code isomorphic to the malfunctioning code but which works and then show the malfunctioning code. Consider t…

---

## [Defining \`--\>\` operator](https://discourse.julialang.org/t/defining-operator/87514)

<div class="topic-metadata">

**Author:** [@digital\_carver](https://discourse.julialang.org/u/digital_carver)\
**Replies:** 1\
**Last updated:** [September 20, 2022, 12:40pm UTC](https://discourse.julialang.org/t/defining-operator/87514 "2022-09-20T12:40:52Z")

</div>

The NEWS.md for Julia 1.6 says: The --\> operator now lowers to a :call expression, so it can be defined as a function like other operators. I originally took this to mean that in earlier versions, you had to use the …

---

## [Struggling to update deprecated Interpolations function](https://discourse.julialang.org/t/struggling-to-update-deprecated-interpolations-function/87431)

<div class="topic-metadata">

**Author:** [@adamhsparks](https://discourse.julialang.org/u/adamhsparks)\
**Replies:** 2\
**Last updated:** [September 20, 2022, 10:40am UTC](https://discourse.julialang.org/t/struggling-to-update-deprecated-interpolations-function/87431 "2022-09-20T10:40:17Z")

</div>

I have a small function in my package that interpolates values and I’ve noted that the function I’d been using, LinearInterpolation(Node, Node, extrapolation\_bc=0), has been deprecated. I’m struggling to understand what…

---

## [Is there a package for printing integer as Unicode superscripts](https://discourse.julialang.org/t/is-there-a-package-for-printing-integer-as-unicode-superscripts/87505)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [September 20, 2022, 8:26am UTC](https://discourse.julialang.org/t/is-there-a-package-for-printing-integer-as-unicode-superscripts/87505 "2022-09-20T08:26:09Z")

</div>

I keep copy-pasting code for printing stuff like the digits in ℝ². It usually goes like const \_SUPERSCRIPT\_DIGITS = \['⁰', '¹', '²', '³', '⁴', '⁵', '⁶', '⁷', '⁸', '⁹'\] function print\_unicode\_superscript(io::IO, k::Integ…

---

## [Nested Loop optimization](https://discourse.julialang.org/t/nested-loop-optimization/87498)

<div class="topic-metadata">

**Author:** [@Jojo](https://discourse.julialang.org/u/Jojo)\
**Replies:** 2\
**Last updated:** [September 20, 2022, 12:01am UTC](https://discourse.julialang.org/t/nested-loop-optimization/87498 "2022-09-20T00:01:50Z")

</div>

Hello, I’ve been working on a solver where I have a nested loop and I want to improve the performance. I think that I’m making unnecessary allocations, for instance I have to write a=copy(a) to force the inner loop to up…

---

## [Optimizing nested for loops and memory allocation in finite differences routine](https://discourse.julialang.org/t/optimizing-nested-for-loops-and-memory-allocation-in-finite-differences-routine/87488)

<div class="topic-metadata">

**Author:** [@Jojo](https://discourse.julialang.org/u/Jojo)\
**Replies:** 3\
**Last updated:** [September 19, 2022, 9:54pm UTC](https://discourse.julialang.org/t/optimizing-nested-for-loops-and-memory-allocation-in-finite-differences-routine/87488 "2022-09-19T21:54:34Z")

</div>

Hi, guys. I’ve been working in a nonlinear wave equation solver using finite differences. My code works properly but I’d like to improve the performance, im working on a 12000\*39000 grid and the average @btime is 15s. I’…

---

## [How to connect to a Web API?](https://discourse.julialang.org/t/how-to-connect-to-a-web-api/87490)

<div class="topic-metadata">

**Author:** [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Replies:** 1\
**Last updated:** [September 19, 2022, 8:38pm UTC](https://discourse.julialang.org/t/how-to-connect-to-a-web-api/87490 "2022-09-19T20:38:10Z")

</div>

TLDR: Please explain to me like I’m a child how Web API’s work. I use project management software called ClickUp that says you can push and pull data to it through its web API. From its documentation, if you click on Li…

---

## [Package to Plot Physical System in Julia](https://discourse.julialang.org/t/package-to-plot-physical-system-in-julia/87470)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 5\
**Last updated:** [September 19, 2022, 6:52pm UTC](https://discourse.julialang.org/t/package-to-plot-physical-system-in-julia/87470 "2022-09-19T18:52:39Z")

</div>

Hi all, I want to know whether there are package that can create this physical system below, or similar, (you can suggest something outside Julia, if there is no such package). Thanks a lot.

---

## [Gaussian process regression with Turing gets stuck](https://discourse.julialang.org/t/gaussian-process-regression-with-turing-gets-stuck/86892)

<div class="topic-metadata">

**Author:** [@soldasim](https://discourse.julialang.org/u/soldasim)\
**Replies:** 6\
**Last updated:** [September 19, 2022, 5:32pm UTC](https://discourse.julialang.org/t/gaussian-process-regression-with-turing-gets-stuck/86892 "2022-09-19T17:32:35Z")

</div>

Hello, I have an issue where sampling with a Turing model with Gaussian process sometimes gets stuck while printing the following error massage over and over: ┌ Warning: \[DynamicPPL\] attempt to link a linked vi └ @ Dyn…

---

## [Project instantiatation never-ending loop](https://discourse.julialang.org/t/project-instantiatation-never-ending-loop/87483)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 1\
**Last updated:** [September 19, 2022, 5:15pm UTC](https://discourse.julialang.org/t/project-instantiatation-never-ending-loop/87483 "2022-09-19T17:15:39Z")

</div>

Hello, Please somehow help me escape this never ending loop. I’m trying to instantiate a project on a cluster. It works perfectly fine on my local machine. Here’s what I find on an interactive repl session. (DRL\_MMULS)…

---

## [Scientific formatting of y-axis using CairoMakie.jl](https://discourse.julialang.org/t/scientific-formatting-of-y-axis-using-cairomakie-jl/87463)

<div class="topic-metadata">

**Author:** [@devanshu](https://discourse.julialang.org/u/devanshu)\
**Replies:** 3\
**Last updated:** [September 19, 2022, 3:54pm UTC](https://discourse.julialang.org/t/scientific-formatting-of-y-axis-using-cairomakie-jl/87463 "2022-09-19T15:54:09Z")

</div>

Hi, I would like to get the formatting of my y-ticks like this How to get this using CairoMakie.jl ?

---

## [Gradient vector of a matrix of geographical extent](https://discourse.julialang.org/t/gradient-vector-of-a-matrix-of-geographical-extent/87318)

<div class="topic-metadata">

**Author:** [@ManuelFossa](https://discourse.julialang.org/u/ManuelFossa)\
**Replies:** 3\
**Last updated:** [September 19, 2022, 12:48pm UTC](https://discourse.julialang.org/t/gradient-vector-of-a-matrix-of-geographical-extent/87318 "2022-09-19T12:48:24Z")

</div>

I have a geographical matrix M of dimensions nLat=181 and nLon=221 , with lats = 30:0.25:90 and lons=-30:0.25:25. I want to compute the gradient vector of M w.r.t to lats , lons. I have tried ForwardDiff , Iterations …

---

## [IRTools need help: purge unused arguments from argument list of a function](https://discourse.julialang.org/t/irtools-need-help-purge-unused-arguments-from-argument-list-of-a-function/86431)

<div class="topic-metadata">

**Author:** [@Lian\_Yunlong](https://discourse.julialang.org/u/Lian_Yunlong)\
**Replies:** 1\
**Last updated:** [August 27, 2022, 2:02pm UTC](https://discourse.julialang.org/t/irtools-need-help-purge-unused-arguments-from-argument-list-of-a-function/86431 "2022-08-27T14:02:20Z")

</div>

Hello, I want to implement a method called “purge\_function\_args”, which remove the n’th argument (which is known to be dummy) from the function arg list. I need a kickstarter for the application of IRTools.jl package. C…

---

## [Transform CodeInfo of a function to get a new function by purging unused args from its arg list](https://discourse.julialang.org/t/transform-codeinfo-of-a-function-to-get-a-new-function-by-purging-unused-args-from-its-arg-list/87459)

<div class="topic-metadata">

**Author:** [@Lian\_Yunlong](https://discourse.julialang.org/u/Lian_Yunlong)\
**Replies:** 1\
**Last updated:** [September 19, 2022, 10:31am UTC](https://discourse.julialang.org/t/transform-codeinfo-of-a-function-to-get-a-new-function-by-purging-unused-args-from-its-arg-list/87459 "2022-09-19T10:31:13Z")

</div>

Hello, I wish to purge an unused argument from the arglist of a function. Following CodeTransformation.jl, I wrote a function to do this task: function assign\_purge\_argument!(@nospecialize(p::Pair{\<:Function,\<:Function…

---

## [Metaprogramming: macro creating types](https://discourse.julialang.org/t/metaprogramming-macro-creating-types/87439)

<div class="topic-metadata">

**Author:** [@davidavdav](https://discourse.julialang.org/u/davidavdav)\
**Replies:** 2\
**Last updated:** [September 19, 2022, 8:52am UTC](https://discourse.julialang.org/t/metaprogramming-macro-creating-types/87439 "2022-09-19T08:52:12Z")

</div>

Hi, I’ve been struggling with making a macro that will define a new wrapper type for me, with some minimal functions to make the wrapper type function more/less the same as the type it waps. For now have the minimal wr…

---

## [How to you call this julia feature?](https://discourse.julialang.org/t/how-to-you-call-this-julia-feature/87413)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 6\
**Last updated:** [September 18, 2022, 8:03am UTC](https://discourse.julialang.org/t/how-to-you-call-this-julia-feature/87413 "2022-09-18T08:03:51Z")

</div>

I am using julia for 5+ years and today I learned about a mind-blowing feature which I wasn’t aware that it exists. julia\> function test\_internal\_state(st) function update\_st() st = st + 1 nothing …

---

## [Using JuliaMath/Interpolations.jl on an image](https://discourse.julialang.org/t/using-juliamath-interpolations-jl-on-an-image/7113)

<div class="topic-metadata">

**Author:** [@mcbaron](https://discourse.julialang.org/u/mcbaron)\
**Replies:** 8\
**Last updated:** [September 19, 2022, 6:18am UTC](https://discourse.julialang.org/t/using-juliamath-interpolations-jl-on-an-image/7113 "2022-09-19T06:18:39Z")

</div>

Hello all, I’m struggling with an OutOfMemory() error while trying to index into an interpolation object with an image size set of indices. I know enough to think that this means that there is probably something wrong w…

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

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