# General Usage

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

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

**Page:** 101

---

## [\[ANN\] Recamans.jl Recamán's sequence](https://discourse.julialang.org/t/ann-recamans-jl-recamans-sequence/124137)

<div class="topic-metadata">

**Author:** [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Replies:** 0\
**Last updated:** [December 23, 2024, 7:52pm UTC](https://discourse.julialang.org/t/ann-recamans-jl-recamans-sequence/124137 "2024-12-23T19:52:06Z")

</div>

The package is here: Recamans.jl Recamán’s sequence a\_0, a\_1, a\_2\\ldots is defined as: a\_n = \\begin{cases} 0 && \\text{if } n = 0 \\\\ a\_{n - 1} -n && \\text{if } a\_{n - 1} -n \> 0 \\text{ and is not already in the sequence…

---

## [Error with importing matplotlib.pyplot for use with PyCall.jl](https://discourse.julialang.org/t/error-with-importing-matplotlib-pyplot-for-use-with-pycall-jl/124062)

<div class="topic-metadata">

**Author:** [@ericdammannjr](https://discourse.julialang.org/u/ericdammannjr)\
**Replies:** 5\
**Last updated:** [December 23, 2024, 7:35pm UTC](https://discourse.julialang.org/t/error-with-importing-matplotlib-pyplot-for-use-with-pycall-jl/124062 "2024-12-23T19:35:41Z")

</div>

I am having an issue with PyCall.jl. For context, I am using a Windows PC with a Julia 1.11.2 and Python 3.13.1. I first created a Python virtual environment in the following directory: "C:\\Research Software\\Python\\Virt…

---

## [Is there a way to find right-inverse (or left-inverse) of a matrix in Julia?](https://discourse.julialang.org/t/is-there-a-way-to-find-right-inverse-or-left-inverse-of-a-matrix-in-julia/124100)

<div class="topic-metadata">

**Author:** [@shubh\_b](https://discourse.julialang.org/u/shubh_b)\
**Replies:** 10\
**Last updated:** [December 23, 2024, 6:23pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-find-right-inverse-or-left-inverse-of-a-matrix-in-julia/124100 "2024-12-23T18:23:41Z")

</div>

Here is the matrix A julia\> A = \[1 2 3; 0 1 2\] 2×3 Matrix{Int64}: 1 2 3 0 1 2 Matrix A has full row-rank julia\> size(A, 1) == rank(A) true and it has a right-inverse. Can we find the right-inverse of this matri…

---

## [Global constants](https://discourse.julialang.org/t/global-constants/124105)

<div class="topic-metadata">

**Author:** [@langestefan](https://discourse.julialang.org/u/langestefan)\
**Replies:** 6\
**Last updated:** [December 23, 2024, 6:14pm UTC](https://discourse.julialang.org/t/global-constants/124105 "2024-12-23T18:14:40Z")

</div>

What is the best (readable, performant) way to store global constants? For example I want to store the Boltzmann constant in a central place and then use it across my package. The compiler would be able to fill this in…

---

## [Issue occurring randomly with 1.11](https://discourse.julialang.org/t/issue-occurring-randomly-with-1-11/121233)

<div class="topic-metadata">

**Author:** [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Replies:** 8\
**Last updated:** [December 23, 2024, 9:51am UTC](https://discourse.julialang.org/t/issue-occurring-randomly-with-1-11/121233 "2024-12-23T09:51:42Z")

</div>

When switching to julia 1.11 in a big project with lots of dependencies, I’ve encountered a strange issue that didn’t happen with 1.10. After some debugging, I’ve managed to isolate the following small reproducible exam…

---

## [Type problem running old julia codes](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993)

<div class="topic-metadata">

**Author:** [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Replies:** 22\
**Last updated:** [December 23, 2024, 9:26am UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993 "2024-12-23T09:26:43Z")

</div>

In running some old julia code (version 0.6.0), I encountered some error: LoadError: UndefVarError: \`T\` not defined The error comes from this line of code: function ph\_conjugate{T}(psi::Vector{T}, states::HaldaneSpher…

---

## [Errors Using PythonCall.jl and PythonPlot.jl with a Python Virtual Environment](https://discourse.julialang.org/t/errors-using-pythoncall-jl-and-pythonplot-jl-with-a-python-virtual-environment/124084)

<div class="topic-metadata">

**Author:** [@ericdammannjr](https://discourse.julialang.org/u/ericdammannjr)\
**Replies:** 2\
**Last updated:** [December 22, 2024, 8:40pm UTC](https://discourse.julialang.org/t/errors-using-pythoncall-jl-and-pythonplot-jl-with-a-python-virtual-environment/124084 "2024-12-22T20:40:02Z")

</div>

I really have been struggling with this issue and not sure what to do. For context, I have a brand-new Windows PC, and I have Julia 1.11.2 and Python 3.13.1 installed on it. I did the following: I created a Python virtu…

---

## [Why my package work locally but not with \]add](https://discourse.julialang.org/t/why-my-package-work-locally-but-not-with-add/124099)

<div class="topic-metadata">

**Author:** [@fdekerme](https://discourse.julialang.org/u/fdekerme)\
**Replies:** 1\
**Last updated:** [December 22, 2024, 6:20pm UTC](https://discourse.julialang.org/t/why-my-package-work-locally-but-not-with-add/124099 "2024-12-22T18:20:51Z")

</div>

Hello :smiley:. I published few month ago my first small package DICOMTree.jl, which dispatches the Tree function of Term.jl for medical DICOM data. When I run the package locally on my machine (git fork, cd DICOMtree,…

---

## [Syntactic sugar for this pattern?](https://discourse.julialang.org/t/syntactic-sugar-for-this-pattern/124096)

<div class="topic-metadata">

**Author:** [@linwaytin](https://discourse.julialang.org/u/linwaytin)\
**Replies:** 2\
**Last updated:** [December 22, 2024, 5:35pm UTC](https://discourse.julialang.org/t/syntactic-sugar-for-this-pattern/124096 "2024-12-22T17:35:59Z")

</div>

Sorry for the vague title, but I don’t even know how to describe it in a few words. The following pseudo code describes the problem. new\_res = some\_fn() res = some\_condition(res, new\_res) ? new\_res : res In short, I ne…

---

## [Invalid memory operation in delete\_object in HDF5](https://discourse.julialang.org/t/invalid-memory-operation-in-delete-object-in-hdf5/124093)

<div class="topic-metadata">

**Author:** [@0samuraiE](https://discourse.julialang.org/u/0samuraiE)\
**Replies:** 4\
**Last updated:** [December 22, 2024, 4:45pm UTC](https://discourse.julialang.org/t/invalid-memory-operation-in-delete-object-in-hdf5/124093 "2024-12-22T16:45:52Z")

</div>

Hi. As title suggests, my application crashes occasionally when call delete\_object. Every time I try, the error message changes. Sometimes free(): invalid pointer malloc(): unaligned tcache chunk detected Aborted (core…

---

## [Small formatting issue in section 6.3 of manual (pdf specific)](https://discourse.julialang.org/t/small-formatting-issue-in-section-6-3-of-manual-pdf-specific/124094)

<div class="topic-metadata">

**Author:** [@kern3020](https://discourse.julialang.org/u/kern3020)\
**Replies:** 1\
**Last updated:** [December 22, 2024, 3:09pm UTC](https://discourse.julialang.org/t/small-formatting-issue-in-section-6-3-of-manual-pdf-specific/124094 "2024-12-22T15:09:54Z")

</div>

Hello, I am reading through the pdf version Manual for Julia 1.11.2 and noticed a small formatting issue. If one goes to section 6.3 “Bitwise operators” and looks at the table here, the symbol for two operators are mis…

---

## [How to concatenate two (file) streams](https://discourse.julialang.org/t/how-to-concatenate-two-file-streams/124082)

<div class="topic-metadata">

**Author:** [@Abhro](https://discourse.julialang.org/u/Abhro)\
**Replies:** 1\
**Last updated:** [December 22, 2024, 6:37am UTC](https://discourse.julialang.org/t/how-to-concatenate-two-file-streams/124082 "2024-12-22T06:37:34Z")

</div>

How to create a stream which sequentially reads from multiple other streams? This is analogous to cat in unix, but for arbitrary streams. In python, something like this might be implemented as: def cat\_streams(s1, s2): …

---

## [In Set, what's decompose?](https://discourse.julialang.org/t/in-set-whats-decompose/124031)

<div class="topic-metadata">

**Author:** [@phma](https://discourse.julialang.org/u/phma)\
**Replies:** 4\
**Last updated:** [December 22, 2024, 6:26am UTC](https://discourse.julialang.org/t/in-set-whats-decompose/124031 "2024-12-22T06:26:38Z")

</div>

I wrote a function which computes something using a SortedSet of a type I defined, which is a fixed-size SVector with no variable-size fields. I thought that maybe using a Set would make it faster, so I changed SortedSet …

---

## [Tell Documenter where symbols are imported from](https://discourse.julialang.org/t/tell-documenter-where-symbols-are-imported-from/124081)

<div class="topic-metadata">

**Author:** [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Replies:** 0\
**Last updated:** [December 22, 2024, 1:48am UTC](https://discourse.julialang.org/t/tell-documenter-where-symbols-are-imported-from/124081 "2024-12-22T01:48:08Z")

</div>

I want to organize my modules so that, among other things, when a user does import MainMod.A at the REPL, and then A.\[TAB\] they see to the extent possible, only symbols in the API. So I want to put the ugly code and the …

---

## [Testing type stability across Julia and JET versions](https://discourse.julialang.org/t/testing-type-stability-across-julia-and-jet-versions/116289)

<div class="topic-metadata">

**Author:** [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Replies:** 7\
**Last updated:** [December 22, 2024, 1:24am UTC](https://discourse.julialang.org/t/testing-type-stability-across-julia-and-jet-versions/116289 "2024-12-22T01:24:36Z")

</div>

In my package DifferentiationInterface.jl, the test suite includes type-stability checks for some differentiation operators. I perform these checks with JET.jl and the @test\_opt macro, which actually verifies a stronger …

---

## [Debugger crashed](https://discourse.julialang.org/t/debugger-crashed/123994)

<div class="topic-metadata">

**Author:** [@stefkuypers](https://discourse.julialang.org/u/stefkuypers)\
**Replies:** 6\
**Last updated:** [December 21, 2024, 8:30pm UTC](https://discourse.julialang.org/t/debugger-crashed/123994 "2024-12-21T20:30:31Z")

</div>

I’m running into a problem where I don’t even know where to start looking for the problem. Well, it seems that there is an undefined variable in the error\_handler.jl file so I’m guessing it might be a bug in the VSCodeDe…

---

## [TestItems produces error in VSCode](https://discourse.julialang.org/t/testitems-produces-error-in-vscode/118591)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 10\
**Last updated:** [December 21, 2024, 8:12pm UTC](https://discourse.julialang.org/t/testitems-produces-error-in-vscode/118591 "2024-12-21T20:12:47Z")

</div>

Hello, I am trying to use TestItems.jl with VSCode, but I have encountered the following error: An error occurred attempting to run tests: Error: Pending response rejected since connection got disposed The output in t…

---

## [How to write a custom actor that also acts as an observable?](https://discourse.julialang.org/t/how-to-write-a-custom-actor-that-also-acts-as-an-observable/107808)

<div class="topic-metadata">

**Author:** [@oliviermilla](https://discourse.julialang.org/u/oliviermilla)\
**Replies:** 3\
**Last updated:** [December 21, 2024, 5:08pm UTC](https://discourse.julialang.org/t/how-to-write-a-custom-actor-that-also-acts-as-an-observable/107808 "2024-12-21T17:08:55Z")

</div>

Hello, in Rocket, I’d like to do something like this: struct CustomActor1 \<: Actor{Any} # Data end function Rocket.on\_next!(a::CustomActor1, data::Any) #Compute using a's data next!() # send result downstr…

---

## [How to speed up converting Dict to Json?](https://discourse.julialang.org/t/how-to-speed-up-converting-dict-to-json/124061)

<div class="topic-metadata">

**Author:** [@Xing\_Shi\_Cai](https://discourse.julialang.org/u/Xing_Shi_Cai)\
**Replies:** 2\
**Last updated:** [December 21, 2024, 2:12pm UTC](https://discourse.julialang.org/t/how-to-speed-up-converting-dict-to-json/124061 "2024-12-21T14:12:03Z")

</div>

I am using Julia and the JSON module to convert a Dict to JSON and sent it to LLM APIs. Below is the code I’m using: function send\_request(url, headers, payload) try @debug "Payload" payload json\_pay…

---

## [What is the most performant way to create an array of functions?](https://discourse.julialang.org/t/what-is-the-most-performant-way-to-create-an-array-of-functions/124055)

<div class="topic-metadata">

**Author:** [@stefkuypers](https://discourse.julialang.org/u/stefkuypers)\
**Replies:** 2\
**Last updated:** [December 21, 2024, 10:58am UTC](https://discourse.julialang.org/t/what-is-the-most-performant-way-to-create-an-array-of-functions/124055 "2024-12-21T10:58:56Z")

</div>

Is there a performant way to create an array of functions over which I can iterate? I’ve noticed that creating a Vector{Function}() has quite a performance hit due to the abstract Function type. I cannot use the concrete…

---

## [RegressionTables.jl: How to Change Star Precision](https://discourse.julialang.org/t/regressiontables-jl-how-to-change-star-precision/124050)

<div class="topic-metadata">

**Author:** [@BMval](https://discourse.julialang.org/u/BMval)\
**Replies:** 1\
**Last updated:** [December 21, 2024, 4:05am UTC](https://discourse.julialang.org/t/regressiontables-jl-how-to-change-star-precision/124050 "2024-12-21T04:05:05Z")

</div>

Does anybody know how to change the number of stars for different p-values in RegressionTables.jl?

---

## [Generate a function via macro and pass to @cfunction. Possible?](https://discourse.julialang.org/t/generate-a-function-via-macro-and-pass-to-cfunction-possible/123988)

<div class="topic-metadata">

**Author:** [@tqml](https://discourse.julialang.org/u/tqml)\
**Replies:** 7\
**Last updated:** [December 20, 2024, 11:59pm UTC](https://discourse.julialang.org/t/generate-a-function-via-macro-and-pass-to-cfunction-possible/123988 "2024-12-20T23:59:09Z")

</div>

I’m trying to write a macro that takes a function, creates a wrapper for it, passes the wrapper to @cfunction and finally passes the function pointer to an external C library. To further clarify the use-case here: I wan…

---

## [Applying sin(-x)=-sin(x) with SymbolicUtils](https://discourse.julialang.org/t/applying-sin-x-sin-x-with-symbolicutils/124002)

<div class="topic-metadata">

**Author:** [@ValterDelft](https://discourse.julialang.org/u/ValterDelft)\
**Replies:** 3\
**Last updated:** [December 20, 2024, 9:27pm UTC](https://discourse.julialang.org/t/applying-sin-x-sin-x-with-symbolicutils/124002 "2024-12-20T21:27:18Z")

</div>

Hi, I am trying to simplify some trigonometric expressions using SymbolicUtils. After applying the product rules for sine and cosine terms, you can end up with negative arguments and I would like to implement the followi…

---

## [Include static pluto/jupyter/marimo notebook in Documenter output](https://discourse.julialang.org/t/include-static-pluto-jupyter-marimo-notebook-in-documenter-output/124039)

<div class="topic-metadata">

**Author:** [@moble](https://discourse.julialang.org/u/moble)\
**Replies:** 1\
**Last updated:** [December 20, 2024, 7:26pm UTC](https://discourse.julialang.org/t/include-static-pluto-jupyter-marimo-notebook-in-documenter-output/124039 "2024-12-20T19:26:43Z")

</div>

Is there some nice way to include any type of notebook, or even just raw HTML, in documentation generated by Documenter? I have several notebooks of sympy calculations that I use to verify lots of formulas in my code. …

---

## [Function arguments](https://discourse.julialang.org/t/function-arguments/61717)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 37\
**Last updated:** [December 20, 2024, 4:56pm UTC](https://discourse.julialang.org/t/function-arguments/61717 "2024-12-20T16:56:59Z")

</div>

Is it possible to pass a named tuple to a function and have the components available as variables without explicitly specifying them as arguments. f( X ) = A + B X = (A=1,B=2) f( X ) output : 3 Background: I have ab…

---

## [Rocket.jl - why is teardown logic never called?](https://discourse.julialang.org/t/rocket-jl-why-is-teardown-logic-never-called/123418)

<div class="topic-metadata">

**Author:** [@AUK1939](https://discourse.julialang.org/u/AUK1939)\
**Replies:** 1\
**Last updated:** [December 20, 2024, 6:55am UTC](https://discourse.julialang.org/t/rocket-jl-why-is-teardown-logic-never-called/123418 "2024-12-20T06:55:48Z")

</div>

Here is an example struct MySubscribable \<: Subscribable{Int} end function Rocket.on\_subscribe!(subscribable::MySubscribable, actor) next!(actor, 1) next!(actor, 2) next!(actor, 3) complete!(actor) …

---

## [Versioninfo not defined in Main](https://discourse.julialang.org/t/versioninfo-not-defined-in-main/123969)

<div class="topic-metadata">

**Author:** [@leespen1](https://discourse.julialang.org/u/leespen1)\
**Replies:** 4\
**Last updated:** [December 20, 2024, 12:22am UTC](https://discourse.julialang.org/t/versioninfo-not-defined-in-main/123969 "2024-12-20T00:22:05Z")

</div>

I was debugging some issues I had using versioninfo() on an HPC, specifically that I would get the following error: ERROR: UndefVarError: \`versioninfo\` not defined in \`Main\` Suggestion: check for spelling errors or miss…

---

## [Keyword argument tab completion](https://discourse.julialang.org/t/keyword-argument-tab-completion/124000)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 1\
**Last updated:** [December 19, 2024, 9:41pm UTC](https://discourse.julialang.org/t/keyword-argument-tab-completion/124000 "2024-12-19T21:41:31Z")

</div>

Is it possible for the REPL or VSCode to autocomplete the name of keywords. For example, after typing range(0,10, len and hitting the Tab key, I’d like to see the compeletion of length=, before I manually type in a val…

---

## [Proper way to ccall mutable types](https://discourse.julialang.org/t/proper-way-to-ccall-mutable-types/123998)

<div class="topic-metadata">

**Author:** [@mattsignorelli](https://discourse.julialang.org/u/mattsignorelli)\
**Replies:** 0\
**Last updated:** [December 19, 2024, 8:53pm UTC](https://discourse.julialang.org/t/proper-way-to-ccall-mutable-types/123998 "2024-12-19T20:53:03Z")

</div>

Suppose I have a type mutable struct MyCType a::Cint b::Ptr{Cdouble} end corresponding exactly to a struct in C. Then I call a C library which has functions like void modify\_struct(myctype \*a) which mutates a. I…

---

## [Getting rid of ForwardDiff.jacobian! allocations when using closures](https://discourse.julialang.org/t/getting-rid-of-forwarddiff-jacobian-allocations-when-using-closures/123939)

<div class="topic-metadata">

**Author:** [@franckgaga](https://discourse.julialang.org/u/franckgaga)\
**Replies:** 6\
**Last updated:** [December 19, 2024, 7:30pm UTC](https://discourse.julialang.org/t/getting-rid-of-forwarddiff-jacobian-allocations-when-using-closures/123939 "2024-12-19T19:30:38Z")

</div>

I’m trying to get rid of the memory allocations in jacobian!. For this, I need to pass a cfg argument with a pre-allocated JacobianConfig to the function. According to the doc, its constructor expects to receive the func…

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

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