# General Usage

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

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

**Page:** 143

---

## [Narrow StructArray column types](https://discourse.julialang.org/t/narrow-structarray-column-types/118041)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 2\
**Last updated:** [August 11, 2024, 5:24pm UTC](https://discourse.julialang.org/t/narrow-structarray-column-types/118041 "2024-08-11T17:24:51Z")

</div>

I want to narrow these column types. I can do it one at a time manually but maybe there’s a better way. identity.(\_) didn’t work. julia\> StructArray(a=Vector{Any}(rand(5)), b=Vector{Any}(rand(5)) ) 5-element StructArray…

---

## [StructArrays and custom data layout](https://discourse.julialang.org/t/structarrays-and-custom-data-layout/34910)

<div class="topic-metadata">

**Author:** [@Kruxigt](https://discourse.julialang.org/u/Kruxigt)\
**Replies:** 0\
**Last updated:** [February 20, 2020, 3:33pm UTC](https://discourse.julialang.org/t/structarrays-and-custom-data-layout/34910 "2020-02-20T15:33:53Z")

</div>

Hello fine fellows! I’m trying to use StructArrays for a custom data layout. Basically, I would like the following to produce a StructArray that includes the parameters field: using StructArrays struct MyStruct data…

---

## [Add Resizable AbstractArray interface for push! and append!?](https://discourse.julialang.org/t/add-resizable-abstractarray-interface-for-push-and-append/118049)

<div class="topic-metadata">

**Author:** [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Replies:** 5\
**Last updated:** [August 11, 2024, 1:06pm UTC](https://discourse.julialang.org/t/add-resizable-abstractarray-interface-for-push-and-append/118049 "2024-08-11T13:06:28Z")

</div>

On Julia 1.10, the following AbstractVector implementation supports push! and append!: julia\> begin struct MyVector \<: AbstractVector{Int} v::Vector{Int} function MyVector(args...) …

---

## [Symbolics and the creation of functions](https://discourse.julialang.org/t/symbolics-and-the-creation-of-functions/118038)

<div class="topic-metadata">

**Author:** [@brombo](https://discourse.julialang.org/u/brombo)\
**Replies:** 2\
**Last updated:** [August 11, 2024, 12:41pm UTC](https://discourse.julialang.org/t/symbolics-and-the-creation-of-functions/118038 "2024-08-11T12:41:38Z")

</div>

Here is an example of code using Julia Symbolics to create a general functions - using SymbolicUtils using Symbolics x = Symbolics.variable("x") y = Symbolics.variable("y") z = Symbolics.variable("z") @variables F(x),…

---

## [Julia Symbolics error when taking derivative of a quotient](https://discourse.julialang.org/t/julia-symbolics-error-when-taking-derivative-of-a-quotient/118007)

<div class="topic-metadata">

**Author:** [@orebas](https://discourse.julialang.org/u/orebas)\
**Replies:** 3\
**Last updated:** [August 11, 2024, 1:40am UTC](https://discourse.julialang.org/t/julia-symbolics-error-when-taking-derivative-of-a-quotient/118007 "2024-08-11T01:40:07Z")

</div>

I’m getting an error, taking derivatives of expressions with quotients, that seems to be coming from Symbolics.jl or maybe SymbolicUtils.jl. It may be related to https://github.com/JuliaSymbolics/Symbolics.jl/issues/11…

---

## [Optimization maxtime in what units?](https://discourse.julialang.org/t/optimization-maxtime-in-what-units/118032)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 1\
**Last updated:** [August 10, 2024, 4:43pm UTC](https://discourse.julialang.org/t/optimization-maxtime-in-what-units/118032 "2024-08-10T16:43:18Z")

</div>

I looked in the docs for Optimization.jl Common Solver Options (Solve Keyword Arguments) · Optimization.jl and it says " maxtime (the maximum of time the optimization runs for)" but it doesn’t mention the units. I’ve b…

---

## [read!(io,Vector{MyStruct} not equivalent to loop over read with eachindex](https://discourse.julialang.org/t/read-io-vector-mystruct-not-equivalent-to-loop-over-read-with-eachindex/117969)

<div class="topic-metadata">

**Author:** [@devel-chm](https://discourse.julialang.org/u/devel-chm)\
**Replies:** 4\
**Last updated:** [August 10, 2024, 3:55pm UTC](https://discourse.julialang.org/t/read-io-vector-mystruct-not-equivalent-to-loop-over-read-with-eachindex/117969 "2024-08-10T15:55:33Z")

</div>

I have a packed structure of data in a binary stream that I wish to read in julia. I defined the type struct and then added a read method to dispatch for that type: struct MyStruct A::Int16 B::Int16 C::In…

---

## [\`print\` vs two-argument \`show\`/\`repr\` vs three-argument \`show\`/\`repr\` with \`MIME"text/plain"\`](https://discourse.julialang.org/t/print-vs-two-argument-show-repr-vs-three-argument-show-repr-with-mime-text-plain/117790)

<div class="topic-metadata">

**Author:** [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Replies:** 5\
**Last updated:** [August 10, 2024, 12:45pm UTC](https://discourse.julialang.org/t/print-vs-two-argument-show-repr-vs-three-argument-show-repr-with-mime-text-plain/117790 "2024-08-10T12:45:51Z")

</div>

I asked this question some time ago on slack, posting now the answers here to avoid the slackhole of oblivion. Thanks to @jakobnissen, @Sukera, and @tecosaur for the information. Question When should I define methods…

---

## [Is this Makie file not parseable by JuliaSyntax.jl?](https://discourse.julialang.org/t/is-this-makie-file-not-parseable-by-juliasyntax-jl/117997)

<div class="topic-metadata">

**Author:** [@Sixzero](https://discourse.julialang.org/u/Sixzero)\
**Replies:** 3\
**Last updated:** [August 10, 2024, 12:02pm UTC](https://discourse.julialang.org/t/is-this-makie-file-not-parseable-by-juliasyntax-jl/117997 "2024-08-10T12:02:34Z")

</div>

I just tried to parse the file: file\_path = ~/.julia/packages/Makie/rEu75/src/Makie.jl @info "Processing file: $file\_path" s = read(file\_path, String) @time expr2 = parsestmt(JuliaSyntax.SyntaxNode, "begin\\n"\*s\*"\\nend"…

---

## [Is there a way to obtain a colorant from color name provided as a Symbol?](https://discourse.julialang.org/t/is-there-a-way-to-obtain-a-colorant-from-color-name-provided-as-a-symbol/88663)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 3\
**Last updated:** [August 10, 2024, 12:30am UTC](https://discourse.julialang.org/t/is-there-a-way-to-obtain-a-colorant-from-color-name-provided-as-a-symbol/88663 "2024-08-10T00:30:28Z")

</div>

When using plotting packages in julia, colors can be passed using a symbol of their name e.g. :red. After searching in Makie’s source code, I could not find where the conversion from Symbol to colorant was done. At the…

---

## [Unicode Characters not allowed in the include function](https://discourse.julialang.org/t/unicode-characters-not-allowed-in-the-include-function/118014)

<div class="topic-metadata">

**Author:** [@willheng](https://discourse.julialang.org/u/willheng)\
**Replies:** 3\
**Last updated:** [August 9, 2024, 10:57pm UTC](https://discourse.julialang.org/t/unicode-characters-not-allowed-in-the-include-function/118014 "2024-08-09T22:57:26Z")

</div>

I created the a QR.jl file as following: using LinearAlgebra, Random, Statistics, SpecialFunctions, BenchmarkTools, LoopVectorization, Distributions function QuantileLoss(r::Vector{T}, τ::T, h::T) where T \<: AbstractFl…

---

## [AC simulation of arbitrary networks (from spice netlists)](https://discourse.julialang.org/t/ac-simulation-of-arbitrary-networks-from-spice-netlists/117972)

<div class="topic-metadata">

**Author:** [@Maarco3108](https://discourse.julialang.org/u/Maarco3108)\
**Replies:** 4\
**Last updated:** [August 9, 2024, 9:48pm UTC](https://discourse.julialang.org/t/ac-simulation-of-arbitrary-networks-from-spice-netlists/117972 "2024-08-09T21:48:08Z")

</div>

Hello guys, I want to create a Julia project for AC simulation of arbitrary networks (from spice netlists) using nodal or loop analysis and then calculate voltage and currents for all elements. There are only R, L, C l…

---

## [How to code-gen unrolled loop over a tuple?](https://discourse.julialang.org/t/how-to-code-gen-unrolled-loop-over-a-tuple/117655)

<div class="topic-metadata">

**Author:** [@bremez](https://discourse.julialang.org/u/bremez)\
**Replies:** 28\
**Last updated:** [August 9, 2024, 8:58pm UTC](https://discourse.julialang.org/t/how-to-code-gen-unrolled-loop-over-a-tuple/117655 "2024-08-09T20:58:52Z")

</div>

I would like a function that accepts a tuple of functions, picks one at random based on provided relative weights, and passes it to a definite second function. Right now, I accomplish this as follows, for e.g. a tuple of…

---

## [Franklin.jl list of pages](https://discourse.julialang.org/t/franklin-jl-list-of-pages/74758)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 5\
**Last updated:** [August 9, 2024, 7:07pm UTC](https://discourse.julialang.org/t/franklin-jl-list-of-pages/74758 "2024-08-09T19:07:36Z")

</div>

I am experimenting with Franklin.jl, with the intention of migrating my blog from Hugo. Suppose I have a bunch of blog posts in a folder structure like pages/blog.md pages/posts/on-why-julia-is-awesome/index.md ... an…

---

## [Order between \`@assume\_effects\` and \`@constprop\`](https://discourse.julialang.org/t/order-between-assume-effects-and-constprop/118001)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 1\
**Last updated:** [August 9, 2024, 2:58pm UTC](https://discourse.julialang.org/t/order-between-assume-effects-and-constprop/118001 "2024-08-09T14:58:31Z")

</div>

I want to use both @assume\_effects :foldable and @constprop :aggressive on some of my methods. Does the order matter? I.e., is there a difference between these two forms: @assume\_effects :foldable @constprop :aggressive…

---

## [OhMyREPL turns off QuikEdit mode](https://discourse.julialang.org/t/ohmyrepl-turns-off-quikedit-mode/117970)

<div class="topic-metadata">

**Author:** [@devel-chm](https://discourse.julialang.org/u/devel-chm)\
**Replies:** 4\
**Last updated:** [August 9, 2024, 1:36pm UTC](https://discourse.julialang.org/t/ohmyrepl-turns-off-quikedit-mode/117970 "2024-08-09T13:36:31Z")

</div>

Is there a way to prevent OhMyREPL from disabling the QuickEdit Mode in windows 10 terminal?

---

## [Help Needed for Simulating Renewal Equation with DifferentialEquations.jl](https://discourse.julialang.org/t/help-needed-for-simulating-renewal-equation-with-differentialequations-jl/117989)

<div class="topic-metadata">

**Author:** [@bachrathyd](https://discourse.julialang.org/u/bachrathyd)\
**Replies:** 3\
**Last updated:** [August 9, 2024, 12:57pm UTC](https://discourse.julialang.org/t/help-needed-for-simulating-renewal-equation-with-differentialequations-jl/117989 "2024-08-09T12:57:14Z")

</div>

Hello everyone, I need some help with simulating a renewal equation, as described in this paper. Here’s a minimal example of the equation I’m working with: x(t) = a \* x(t - 1) + b \* x(t - √2) I want to solve this usin…

---

## [Linking to a markdown document](https://discourse.julialang.org/t/linking-to-a-markdown-document/117947)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 7\
**Last updated:** [August 9, 2024, 12:41pm UTC](https://discourse.julialang.org/t/linking-to-a-markdown-document/117947 "2024-08-09T12:41:42Z")

</div>

Is it possible to link to a mark-down document that just shows the document and not the Github menu etc? For example, I would like to find a way to show this document: Installation of Julia using an internet link and …

---

## [Fun with Unicode: TemplateᐸTᐳ syntax and more](https://discourse.julialang.org/t/fun-with-unicode-template-t-syntax-and-more/117995)

<div class="topic-metadata">

**Author:** [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Replies:** 4\
**Last updated:** [August 9, 2024, 12:24pm UTC](https://discourse.julialang.org/t/fun-with-unicode-template-t-syntax-and-more/117995 "2024-08-09T12:24:36Z")

</div>

Inspired by a Go example: julia\> const VectorᐸIntᐳ = Vector{Int} Vector{Int64} (alias for Array{Int64, 1}) julia\> \[1,2,3\] isa VectorᐸIntᐳ true julia\> x = 2 2 julia\> xᐸ3 = x\<3 true julia\> xᐸ3+4 5 julia\> ᐸ = \> \> (gen…

---

## [Naming macro and function the same](https://discourse.julialang.org/t/naming-macro-and-function-the-same/117959)

<div class="topic-metadata">

**Author:** [@martin\_sanchez](https://discourse.julialang.org/u/martin_sanchez)\
**Replies:** 7\
**Last updated:** [August 9, 2024, 5:26am UTC](https://discourse.julialang.org/t/naming-macro-and-function-the-same/117959 "2024-08-09T05:26:13Z")

</div>

In the Source code of Reexport, they define a macro Reexport, inmediately define a behaviour (I assume macros can also have multiple dispatch…?) and then they define a function with the same name: macro reexport(ex::Exp…

---

## [MolecularGraph.jl error for drawing 3D molecule](https://discourse.julialang.org/t/moleculargraph-jl-error-for-drawing-3d-molecule/117963)

<div class="topic-metadata">

**Author:** [@beryl](https://discourse.julialang.org/u/beryl)\
**Replies:** 2\
**Last updated:** [August 9, 2024, 5:08am UTC](https://discourse.julialang.org/t/moleculargraph-jl-error-for-drawing-3d-molecule/117963 "2024-08-09T05:08:05Z")

</div>

Hi, I tried the example for drawing 3D molecules in https://mojaie.github.io/MolecularGraph.jl\_notebook/drawing\_molecule.html. (at the end of the page). However it gave an error when I called: spacefilling(mol) The e…

---

## [Cant use module normally](https://discourse.julialang.org/t/cant-use-module-normally/117973)

<div class="topic-metadata">

**Author:** [@martin\_sanchez](https://discourse.julialang.org/u/martin_sanchez)\
**Replies:** 4\
**Last updated:** [August 9, 2024, 12:55am UTC](https://discourse.julialang.org/t/cant-use-module-normally/117973 "2024-08-09T00:55:43Z")

</div>

In This tutorial they even have an online code executer in which they set the example of using a module. They first have a file mymodule.jl in which they write: \`module MyModule export sum\_function, resta function sum…

---

## [Type instability in list comprehensions](https://discourse.julialang.org/t/type-instability-in-list-comprehensions/117673)

<div class="topic-metadata">

**Author:** [@mwallerb](https://discourse.julialang.org/u/mwallerb)\
**Replies:** 46\
**Last updated:** [August 9, 2024, 12:28am UTC](https://discourse.julialang.org/t/type-instability-in-list-comprehensions/117673 "2024-08-09T00:28:47Z")

</div>

Consider the following code: julia\> x = \[1, 2\]; julia\> y = Float64\[\]; julia\> \[xi \* yi for xi in x for yi in y\] Any\[\] julia\> f(x, y) = \[xi \* yi for xi in x for yi in y\]; f(x, y) Float64\[\] so the whole thing is type-uns…

---

## [Makie crash](https://discourse.julialang.org/t/makie-crash/117942)

<div class="topic-metadata">

**Author:** [@sransome](https://discourse.julialang.org/u/sransome)\
**Replies:** 6\
**Last updated:** [August 8, 2024, 10:50pm UTC](https://discourse.julialang.org/t/makie-crash/117942 "2024-08-08T22:50:29Z")

</div>

I have a Makie based application that involves using the mesh! function. This line of code works fin in the repl but embedded in the application (its quite complex) everything crashes. Even the repl crashes. mesh!(spr…

---

## [Fastest way to perform A\[a,:\] \* B \* A’\[:,b\] where a and b are vectors of indices](https://discourse.julialang.org/t/fastest-way-to-perform-a-a-b-a-b-where-a-and-b-are-vectors-of-indices/117958)

<div class="topic-metadata">

**Author:** [@eveningsilverfox](https://discourse.julialang.org/u/eveningsilverfox)\
**Replies:** 5\
**Last updated:** [August 8, 2024, 8:37pm UTC](https://discourse.julialang.org/t/fastest-way-to-perform-a-a-b-a-b-where-a-and-b-are-vectors-of-indices/117958 "2024-08-08T20:37:31Z")

</div>

This question is a follow-up to To recap, given two dense square matrices with ComplexF64 elements of size approximately 100000X100000, A and B, what is the fastest way to perform R=ABA’, where A’=conj(tr(A)) is the He…

---

## [Issue about "Pkg"](https://discourse.julialang.org/t/issue-about-pkg/117915)

<div class="topic-metadata">

**Author:** [@lionisxn](https://discourse.julialang.org/u/lionisxn)\
**Replies:** 3\
**Last updated:** [August 8, 2024, 4:42pm UTC](https://discourse.julialang.org/t/issue-about-pkg/117915 "2024-08-08T16:42:01Z")

</div>

After I used Pkg.update() in VSCODE, Julia crashed and can not start anymore. I restarted the julia directly via executable Julia.exe in Windows, and errors were thrown like this What happened to my settings? Very we…

---

## [Optimize splitting vector of strings](https://discourse.julialang.org/t/optimize-splitting-vector-of-strings/117924)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 10\
**Last updated:** [August 8, 2024, 1:27pm UTC](https://discourse.julialang.org/t/optimize-splitting-vector-of-strings/117924 "2024-08-08T13:27:50Z")

</div>

I am learning how to optimize julia code and came up with the following MWE: using BenchmarkTools, Profile strvec = \["AA entryA", "BBC entryB", "CCM entryC"\] function split\_vec(strvec) mat = stack(split.(strvec),…

---

## [Problem with Gamma function](https://discourse.julialang.org/t/problem-with-gamma-function/117941)

<div class="topic-metadata">

**Author:** [@Charles\_Nutter](https://discourse.julialang.org/u/Charles_Nutter)\
**Replies:** 5\
**Last updated:** [August 8, 2024, 2:38pm UTC](https://discourse.julialang.org/t/problem-with-gamma-function/117941 "2024-08-08T14:38:33Z")

</div>

Invoking the Gamma function fails. Although the Pkg.add downloads the algorithms. I had to write out the gamma function: gamma=quadgk(z-\> (t^(z-1)\*exp(z-t)),0,1,rtol=1e-4) (0.17730992497288517, 2.7755575615628914e-17) …

---

## [Square-Root Kalman-Filter: Calculate only upper triangular of QR-decomposition](https://discourse.julialang.org/t/square-root-kalman-filter-calculate-only-upper-triangular-of-qr-decomposition/55621)

<div class="topic-metadata">

**Author:** [@zsoerenm](https://discourse.julialang.org/u/zsoerenm)\
**Replies:** 9\
**Last updated:** [August 8, 2024, 1:23pm UTC](https://discourse.julialang.org/t/square-root-kalman-filter-calculate-only-upper-triangular-of-qr-decomposition/55621 "2024-08-08T13:23:54Z")

</div>

I’m implementing the Square-Root Kalman-Filter similar to this python implementation: Python - Square-Root Kalman-Filter The implementation calculates the QR-decomposition, but it only needs the upper triangular matrix…

---

## [Creating a conditional log](https://discourse.julialang.org/t/creating-a-conditional-log/117932)

<div class="topic-metadata">

**Author:** [@korch](https://discourse.julialang.org/u/korch)\
**Replies:** 9\
**Last updated:** [August 8, 2024, 12:47pm UTC](https://discourse.julialang.org/t/creating-a-conditional-log/117932 "2024-08-08T12:47:40Z")

</div>

Hi there! TLDR: I want to make a logger for my code that outputs the unevaluated expressions and evaluated expression sometimes - like on one time step. It seems the only way to do this is with a macro, but I can’t figu…

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

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