# General Usage

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

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

**Page:** 71

---

## [A = A .+ 1 yields different type than A .+= 1; why?](https://discourse.julialang.org/t/a-a-1-yields-different-type-than-a-1-why/128189)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 12\
**Last updated:** [April 18, 2025, 7:17pm UTC](https://discourse.julialang.org/t/a-a-1-yields-different-type-than-a-1-why/128189 "2025-04-18T19:17:58Z")

</div>

In the code below, I had expected the three additions at the end to produce the same type. Plus, given that the constructor of Share should throw an error when its argument is outside the range 0 to 1, I would not have …

---

## [Looking for type-stable way to update several struct fields from NamedTuple](https://discourse.julialang.org/t/looking-for-type-stable-way-to-update-several-struct-fields-from-namedtuple/128182)

<div class="topic-metadata">

**Author:** [@Ickaser](https://discourse.julialang.org/u/Ickaser)\
**Replies:** 5\
**Last updated:** [April 18, 2025, 9:52am UTC](https://discourse.julialang.org/t/looking-for-type-stable-way-to-update-several-struct-fields-from-namedtuple/128182 "2025-04-18T09:52:02Z")

</div>

Hello, I’ve been poring over docs for Accessors.jl, Setfield.jl, Parameters.jl, and Discourse, and haven’t found a clear answer to this question. The problem I would like to solve is expressed by this MWE: struct Para…

---

## ["Illegal" macro names](https://discourse.julialang.org/t/illegal-macro-names/128136)

<div class="topic-metadata">

**Author:** [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Replies:** 6\
**Last updated:** [April 17, 2025, 6:35pm UTC](https://discourse.julialang.org/t/illegal-macro-names/128136 "2025-04-17T18:35:13Z")

</div>

I am wondering if there is any reason to avoid macro names which the parser would normally reject? For example, in BorrowChecker.jl, I want to define the @& macro: julia\> @& Vector Union{Vector, Borrowed{\<:Vector}, Lazy…

---

## [Warning both package a and b export the same function](https://discourse.julialang.org/t/warning-both-package-a-and-b-export-the-same-function/128160)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 10\
**Last updated:** [April 17, 2025, 6:30pm UTC](https://discourse.julialang.org/t/warning-both-package-a-and-b-export-the-same-function/128160 "2025-04-17T18:30:11Z")

</div>

With Julia 1.10 I get the following warning: WARNING: both VortexStepMethod and NonlinearSolve export "solve!"; uses of it in module KiteModels must be qualified I don’t get it with Julia 1.11. Any idea why? What is t…

---

## [Macro to generate 2 keyword function parameters](https://discourse.julialang.org/t/macro-to-generate-2-keyword-function-parameters/128161)

<div class="topic-metadata">

**Author:** [@filchristou](https://discourse.julialang.org/u/filchristou)\
**Replies:** 3\
**Last updated:** [April 17, 2025, 3:43pm UTC](https://discourse.julialang.org/t/macro-to-generate-2-keyword-function-parameters/128161 "2025-04-17T15:43:57Z")

</div>

Let’s say I have this function import Dates: DateTime function myfun1(; ena::Int=1, offsettime::DateTime, entrytime::DateTime, dio::Int) return nothing end with the parameters being :($(Expr(:parameters, :($(Expr(…

---

## [StructArrays + custom broadcasting + Makie](https://discourse.julialang.org/t/structarrays-custom-broadcasting-makie/128140)

<div class="topic-metadata">

**Author:** [@DanielIngraham](https://discourse.julialang.org/u/DanielIngraham)\
**Replies:** 4\
**Last updated:** [April 17, 2025, 1:20pm UTC](https://discourse.julialang.org/t/structarrays-custom-broadcasting-makie/128140 "2025-04-17T13:20:43Z")

</div>

I’d like to customize broadcasting for a type, such that Julia will allocate the result using a StructArray from the StructArrays.jl package instead of a plain array. This is actually very easy to do: julia\> struct Foo{…

---

## [Example of wavelet analysis of a surface](https://discourse.julialang.org/t/example-of-wavelet-analysis-of-a-surface/128050)

<div class="topic-metadata">

**Author:** [@Gravlax](https://discourse.julialang.org/u/Gravlax)\
**Replies:** 3\
**Last updated:** [April 17, 2025, 11:49am UTC](https://discourse.julialang.org/t/example-of-wavelet-analysis-of-a-surface/128050 "2025-04-17T11:49:48Z")

</div>

Dear all, I would like to analysis images of surface with variable roughness in space. In practice, I would like to quantify the roughness of signals and report it on 2D maps (in the original spatial coordinates). It se…

---

## [Mutable structs seem cause way more allocations in multithreaded code](https://discourse.julialang.org/t/mutable-structs-seem-cause-way-more-allocations-in-multithreaded-code/128156)

<div class="topic-metadata">

**Author:** [@Salmon](https://discourse.julialang.org/u/Salmon)\
**Replies:** 2\
**Last updated:** [April 17, 2025, 10:10am UTC](https://discourse.julialang.org/t/mutable-structs-seem-cause-way-more-allocations-in-multithreaded-code/128156 "2025-04-17T10:10:34Z")

</div>

Hi everyone, I have encountered a pretty annoying performance bottleneck when using StatsBase.Weights, which is a mutable struct (whatever may be the reason for that :P) , in a multithreaded setting. After going down t…

---

## [Get \`ERROR: julia: -t,--threads=\<n\>\[,auto|\<m\>\]; n must be an integer \>= 1\` when running test](https://discourse.julialang.org/t/get-error-julia-t-threads-n-auto-m-n-must-be-an-integer-1-when-running-test/128131)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 5\
**Last updated:** [April 17, 2025, 8:52am UTC](https://discourse.julialang.org/t/get-error-julia-t-threads-n-auto-m-n-must-be-an-integer-1-when-running-test/128131 "2025-04-17T08:52:23Z")

</div>

Not sure what to do here. I have a laptop I haven’t really worked much on for like 6 months. Running Julia on it has been fine. However, now I tried to run the tests of a package that I develop. I activate the environmen…

---

## [Leveraging the GDAL VSI for “raw” access to NetCDF/HDF5 files inside a Zip archive?](https://discourse.julialang.org/t/leveraging-the-gdal-vsi-for-raw-access-to-netcdf-hdf5-files-inside-a-zip-archive/128129)

<div class="topic-metadata">

**Author:** [@Oblomov](https://discourse.julialang.org/u/Oblomov)\
**Replies:** 9\
**Last updated:** [April 17, 2025, 6:27am UTC](https://discourse.julialang.org/t/leveraging-the-gdal-vsi-for-raw-access-to-netcdf-hdf5-files-inside-a-zip-archive/128129 "2025-04-17T06:27:47Z")

</div>

Hello all, I have an interesting conundrum. My situation is the following: I have some data which is distributed as a zip archive of .nc files. The files are rather large, so I would prefer to not unzip the archive to r…

---

## [Smallest magnitude sparse generalized eigenvalues](https://discourse.julialang.org/t/smallest-magnitude-sparse-generalized-eigenvalues/128095)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 13\
**Last updated:** [April 17, 2025, 6:13am UTC](https://discourse.julialang.org/t/smallest-magnitude-sparse-generalized-eigenvalues/128095 "2025-04-17T06:13:13Z")

</div>

Hi, I am trying to find the neig=5 smallest eigenvalues (in magnitude) of a generalised problem (K-val\*M)\*vec = 0 where K is real symmetric positive indefinite and M is real symmetric positive definite. This is close…

---

## [Vim LaTeX-to-Unicode substitutions](https://discourse.julialang.org/t/vim-latex-to-unicode-substitutions/128109)

<div class="topic-metadata">

**Author:** [@Doug719](https://discourse.julialang.org/u/Doug719)\
**Replies:** 3\
**Last updated:** [April 16, 2025, 11:09pm UTC](https://discourse.julialang.org/t/vim-latex-to-unicode-substitutions/128109 "2025-04-16T23:09:11Z")

</div>

I am using vim on macos, latest version. I have tried the installation instructions in JuliaEditorSupport/julia-vim. The LaTex-to-Unicode substitutions do not work. I would appreciate some detailed advice on how to ge…

---

## [Copying folder including subfolders](https://discourse.julialang.org/t/copying-folder-including-subfolders/104065)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 10\
**Last updated:** [April 16, 2025, 8:02pm UTC](https://discourse.julialang.org/t/copying-folder-including-subfolders/104065 "2025-04-16T20:02:33Z")

</div>

Is there an easy way to copy the contents of one folder, including all subfolders, to another folder? It seems that cp() supported the recursive keyword at one point, but not anymore.

---

## [Error: peer didn't connect](https://discourse.julialang.org/t/error-peer-didnt-connect/128130)

<div class="topic-metadata">

**Author:** [@liamh](https://discourse.julialang.org/u/liamh)\
**Replies:** 0\
**Last updated:** [April 16, 2025, 4:08pm UTC](https://discourse.julialang.org/t/error-peer-didnt-connect/128130 "2025-04-16T16:08:46Z")

</div>

Occasionally I get a message like this. The last time it happened, I lost all the work from a two-week computation. What causes it and how can I prevent it? Update: I have found this post and have tried setting Distribu…

---

## [Fancy LLVM loop transformation pass that deoptimize the code](https://discourse.julialang.org/t/fancy-llvm-loop-transformation-pass-that-deoptimize-the-code/128100)

<div class="topic-metadata">

**Author:** [@JohnnyChen94](https://discourse.julialang.org/u/JohnnyChen94)\
**Replies:** 2\
**Last updated:** [April 16, 2025, 11:27am UTC](https://discourse.julialang.org/t/fancy-llvm-loop-transformation-pass-that-deoptimize-the-code/128100 "2025-04-16T11:27:00Z")

</div>

Recently we’ve seen one strange performance regression report, and the following is a MWE we can get: using BenchmarkTools function rand\_n\_1(a,n) r = Vector{UInt}(undef,n) @inbounds for i in 1:n p = a\[1…

---

## [Sequence motifs in pure Julia](https://discourse.julialang.org/t/sequence-motifs-in-pure-julia/128047)

<div class="topic-metadata">

**Author:** [@candidaorelmex](https://discourse.julialang.org/u/candidaorelmex)\
**Replies:** 4\
**Last updated:** [April 15, 2025, 8:46pm UTC](https://discourse.julialang.org/t/sequence-motifs-in-pure-julia/128047 "2025-04-15T20:46:42Z")

</div>

Hi everyone, I’m writing for a little package for myself and to maybe share with the community one day, if it’s mature enough. I want to plot sequence motifs of letters (or peptides for those who are curious about the c…

---

## [Possibly mildly faster sign for integers?](https://discourse.julialang.org/t/possibly-mildly-faster-sign-for-integers/128086)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 12\
**Last updated:** [April 15, 2025, 5:22pm UTC](https://discourse.julialang.org/t/possibly-mildly-faster-sign-for-integers/128086 "2025-04-15T17:22:52Z")

</div>

Suggested in a stackoverflow answer on micro optimization - Fast sign of integer in C - Stack Overflow julia\> \_sign(x) = (x \> 0) - (x \< 0) \_sign (generic function with 1 method) Using this, julia\> v = 1:1\_000; w = sim…

---

## [Question about model change in Nonlinear system solve](https://discourse.julialang.org/t/question-about-model-change-in-nonlinear-system-solve/128081)

<div class="topic-metadata">

**Author:** [@ysyecust](https://discourse.julialang.org/u/ysyecust)\
**Replies:** 4\
**Last updated:** [April 15, 2025, 4:05pm UTC](https://discourse.julialang.org/t/question-about-model-change-in-nonlinear-system-solve/128081 "2025-04-15T16:05:59Z")

</div>

I am using Julia to solve a system of nonlinear equations, but my model has phase changes, meaning there are switches in the equations of the model itself. If the solution enters a single-phase region, the original conse…

---

## [2nd Order Newton's Method with Sparse Hessian](https://discourse.julialang.org/t/2nd-order-newtons-method-with-sparse-hessian/127313)

<div class="topic-metadata">

**Author:** [@luke-kiernan](https://discourse.julialang.org/u/luke-kiernan)\
**Replies:** 7\
**Last updated:** [April 15, 2025, 3:47pm UTC](https://discourse.julialang.org/t/2nd-order-newtons-method-with-sparse-hessian/127313 "2025-04-15T15:47:14Z")

</div>

I have a function that I wish to minimize via a 2nd order newton’s method with line search. I have an explicit gradient and Hessian. Moreover, the Hessian is sparse, and I care about performance (e.g. if possible, re-use…

---

## [Clang.jl on a Header with Function Overloading](https://discourse.julialang.org/t/clang-jl-on-a-header-with-function-overloading/128083)

<div class="topic-metadata">

**Author:** [@luke-kiernan](https://discourse.julialang.org/u/luke-kiernan)\
**Replies:** 0\
**Last updated:** [April 15, 2025, 2:57am UTC](https://discourse.julialang.org/t/clang-jl-on-a-header-with-function-overloading/128083 "2025-04-15T02:57:53Z")

</div>

Is it possible to use Clang.jl to parse a header that uses the overloadable attribute? When I try, it only parses the first function with each name. Here’s my build setup: you’ll have to be on an Apple Silicon Mac to run…

---

## [Julian way to implement structs with different "defaults"?](https://discourse.julialang.org/t/julian-way-to-implement-structs-with-different-defaults/128046)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 19\
**Last updated:** [April 15, 2025, 1:31pm UTC](https://discourse.julialang.org/t/julian-way-to-implement-structs-with-different-defaults/128046 "2025-04-15T13:31:05Z")

</div>

Which could be a “julian” way to implement multiple struct defaults? Like: abstract type Parameters end Base.@kwdef struct ParametersDefault1 \<: Parameters x = 5 y = \[1,2,3\] w = 10 z = x .+ y end Bas…

---

## [Plot of a function from x=0 to x=1 is not shown](https://discourse.julialang.org/t/plot-of-a-function-from-x-0-to-x-1-is-not-shown/128091)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 6\
**Last updated:** [April 15, 2025, 1:09pm UTC](https://discourse.julialang.org/t/plot-of-a-function-from-x-0-to-x-1-is-not-shown/128091 "2025-04-15T13:09:53Z")

</div>

Hi all, I tried to plot a function \\frac{1}{(x-1)^{2/3}} but it can only plot the function from x=1 to the right. There should also be the plot from from x=0 to x=1 toward infinity. This is the suppose to be function …

---

## [\*\*Pluto.jl\*\* precompilation error in Julia v1.11.5](https://discourse.julialang.org/t/pluto-jl-precompilation-error-in-julia-v1-11-5/128088)

<div class="topic-metadata">

**Author:** [@Soel](https://discourse.julialang.org/u/Soel)\
**Replies:** 1\
**Last updated:** [April 15, 2025, 9:40am UTC](https://discourse.julialang.org/t/pluto-jl-precompilation-error-in-julia-v1-11-5/128088 "2025-04-15T09:40:54Z")

</div>

Hello all, Same UndefVarError when trying to precompile Pluto.jl under Julia v1.11.5 ? Regards. . . . ERROR: LoadError: UndefVarError: \`complete\_remote\_package\` not defined in \`REPLExt\` Suggestion: check f…

---

## [Large memory consumption when using Mooncake via DifferentiationInterface for Gaussian process optimisation](https://discourse.julialang.org/t/large-memory-consumption-when-using-mooncake-via-differentiationinterface-for-gaussian-process-optimisation/127289)

<div class="topic-metadata">

**Author:** [@Nikos\_Gianniotis](https://discourse.julialang.org/u/Nikos_Gianniotis)\
**Replies:** 19\
**Last updated:** [April 15, 2025, 7:20am UTC](https://discourse.julialang.org/t/large-memory-consumption-when-using-mooncake-via-differentiationinterface-for-gaussian-process-optimisation/127289 "2025-04-15T07:20:30Z")

</div>

Hello everyone, I am working on a model called the Gaussian process latent variable model (GPLVM). The GPLVM is a dimensionality reduction method which given a high dimensional dataset Y will return low-dimensional proj…

---

## [Preserve sparse structure during in-place operations](https://discourse.julialang.org/t/preserve-sparse-structure-during-in-place-operations/127864)

<div class="topic-metadata">

**Author:** [@luke-kiernan](https://discourse.julialang.org/u/luke-kiernan)\
**Replies:** 1\
**Last updated:** [April 15, 2025, 2:00am UTC](https://discourse.julialang.org/t/preserve-sparse-structure-during-in-place-operations/127864 "2025-04-15T02:00:02Z")

</div>

SparseArrays automatically runs dropzeros! after certain operations: for example, using SparseArrays A = spdiagm(ones(3)) println(nnz(A)) # result: 3 A .+= spdiagm(-1 .\* ones(3)) println(nnz(A)) # result: 0 How can I p…

---

## [ERROR: MethodError: no method matching run\_interface](https://discourse.julialang.org/t/error-methoderror-no-method-matching-run-interface/128073)

<div class="topic-metadata">

**Author:** [@liamh](https://discourse.julialang.org/u/liamh)\
**Replies:** 0\
**Last updated:** [April 14, 2025, 7:54pm UTC](https://discourse.julialang.org/t/error-methoderror-no-method-matching-run-interface/128073 "2025-04-14T19:54:29Z")

</div>

When I insert @infiltrate in my code, execution stops as expected, but then I get the error. ERROR: MethodError: no method matching run\_interface(::REPL.Terminals.TTYTerminal, ::REPL.LineEdit.ModalInterface) The functio…

---

## [Repeated Convolutions With Large 1D Arrays](https://discourse.julialang.org/t/repeated-convolutions-with-large-1d-arrays/127194)

<div class="topic-metadata">

**Author:** [@donkeysaddle](https://discourse.julialang.org/u/donkeysaddle)\
**Replies:** 20\
**Last updated:** [April 14, 2025, 7:45pm UTC](https://discourse.julialang.org/t/repeated-convolutions-with-large-1d-arrays/127194 "2025-04-14T19:45:45Z")

</div>

What’s the optimal way to compute repeated convolutions with large 1D arrays? the filters, (g\_x,g\_y, & g\_z) stay the same each iteration, but the “signals” change. To be clear, the computation of the f’s is fast, the co…

---

## [Find indexes of a String in Multi -Type Matrix](https://discourse.julialang.org/t/find-indexes-of-a-string-in-multi-type-matrix/128072)

<div class="topic-metadata">

**Author:** [@Vasilis\_Dim](https://discourse.julialang.org/u/Vasilis_Dim)\
**Replies:** 2\
**Last updated:** [April 14, 2025, 7:20pm UTC](https://discourse.julialang.org/t/find-indexes-of-a-string-in-multi-type-matrix/128072 "2025-04-14T19:20:36Z")

</div>

Hello There! I have created a matrix such as: T=Union{String, Int} June=Matrix{T}(undef,10,30) Later in the code some entries of A might change to a string (let’s say “Bill”). I tried to locate the indexes where that’…

---

## [Equivalent of Clojure \`some-\>\` for nested data?](https://discourse.julialang.org/t/equivalent-of-clojure-some-for-nested-data/127641)

<div class="topic-metadata">

**Author:** [@danielmatz](https://discourse.julialang.org/u/danielmatz)\
**Replies:** 5\
**Last updated:** [April 14, 2025, 5:05pm UTC](https://discourse.julialang.org/t/equivalent-of-clojure-some-for-nested-data/127641 "2025-04-14T17:05:14Z")

</div>

I’m a happy user of both Chain.jl and Accessors.jl, but I find myself missing a few things from Clojure. I’m not sure if they exist, and I just don’t know about them, or if these are actual missing capabilities. I think…

---

## [Limitations of \`Base.convert\` for the construction of parametric types](https://discourse.julialang.org/t/limitations-of-base-convert-for-the-construction-of-parametric-types/127977)

<div class="topic-metadata">

**Author:** [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Replies:** 4\
**Last updated:** [April 11, 2025, 9:35pm UTC](https://discourse.julialang.org/t/limitations-of-base-convert-for-the-construction-of-parametric-types/127977 "2025-04-11T21:35:25Z")

</div>

I have a couple of user-defined types in which one contains the other, as in the following minimal example: struct MyType x::Float64 end struct Container c::MyType end In this example, MyType is some kind of F…

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

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