# General Usage

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

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

**Page:** 200

---

## [Benchmarking function in local scope](https://discourse.julialang.org/t/benchmarking-function-in-local-scope/110228)

<div class="topic-metadata">

**Author:** [@leespen1](https://discourse.julialang.org/u/leespen1)\
**Replies:** 4\
**Last updated:** [February 16, 2024, 7:48pm UTC](https://discourse.julialang.org/t/benchmarking-function-in-local-scope/110228 "2024-02-16T19:48:56Z")

</div>

I have a function that I would like to benchmark. To that end, I would like to time the function for several different argument values, and plot how the runtime changes with the argument values. I can do this using the @…

---

## [Is it posible to have MVectors with overlaping data?](https://discourse.julialang.org/t/is-it-posible-to-have-mvectors-with-overlaping-data/110275)

<div class="topic-metadata">

**Author:** [@Joaquin\_Rodriguez](https://discourse.julialang.org/u/Joaquin_Rodriguez)\
**Replies:** 2\
**Last updated:** [February 16, 2024, 7:17pm UTC](https://discourse.julialang.org/t/is-it-posible-to-have-mvectors-with-overlaping-data/110275 "2024-02-16T19:17:57Z")

</div>

I am defining a type which contains a 6-element MVector. I would like to have to views into each half of this vector, like so: Of course, I could create them using view1 = view(myvector, 1:3) and view2 = view(myvecto…

---

## [ENV\["PATH"\] is different for REPL started through VS Code](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253)

<div class="topic-metadata">

**Author:** [@dylan-asmar](https://discourse.julialang.org/u/dylan-asmar)\
**Replies:** 14\
**Last updated:** [February 16, 2024, 7:03pm UTC](https://discourse.julialang.org/t/env-path-is-different-for-repl-started-through-vs-code/105253 "2024-02-16T19:03:54Z")

</div>

If I start the REPL using VS Code (Julia: Start REPL), I get different results for ENV\["PATH"\] than if I start the REPL in any other way. VS Code: Version 1.83.1 Julia: 1.9.3 OS: MacOS Sonoma 14.0 I am assuming it is…

---

## [How to log in to Facebook with Julia?](https://discourse.julialang.org/t/how-to-log-in-to-facebook-with-julia/110301)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 2\
**Last updated:** [February 16, 2024, 4:52pm UTC](https://discourse.julialang.org/t/how-to-log-in-to-facebook-with-julia/110301 "2024-02-16T16:52:23Z")

</div>

I would like to automate browsing my FB, how to start optimally with Julia Paul

---

## [ModelingToolkit Extract conserved quantities](https://discourse.julialang.org/t/modelingtoolkit-extract-conserved-quantities/110296)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 2\
**Last updated:** [February 16, 2024, 4:25pm UTC](https://discourse.julialang.org/t/modelingtoolkit-extract-conserved-quantities/110296 "2024-02-16T16:25:00Z")

</div>

Hello, I am interested in a chemical model given by: using ModelingToolkit using OrdinaryDiffEq @parameters k1 k2 k3 k4 k5 k6 k7 k8 k9 k10 k11 M @variables t O1D(t) O(t) O3(t) O2(t) NO(t) NO2(t) σ(t) r1(t) r2(t) r3(t)…

---

## [M1 Mac Faile to install BinaryProvider Package](https://discourse.julialang.org/t/m1-mac-faile-to-install-binaryprovider-package/74103)

<div class="topic-metadata">

**Author:** [@Jack](https://discourse.julialang.org/u/Jack)\
**Replies:** 19\
**Last updated:** [February 16, 2024, 2:36pm UTC](https://discourse.julialang.org/t/m1-mac-faile-to-install-binaryprovider-package/74103 "2024-02-16T14:36:58Z")

</div>

When I try to run Julia on the new m1 mac, it would break from time to time. I checked if there is any package that’s broken, and found this after doing the precompile Precompiling project... ✗ BinaryProvider 0 depe…

---

## [No such file when using backticks for running external program](https://discourse.julialang.org/t/no-such-file-when-using-backticks-for-running-external-program/110264)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 10\
**Last updated:** [February 16, 2024, 9:50am UTC](https://discourse.julialang.org/t/no-such-file-when-using-backticks-for-running-external-program/110264 "2024-02-16T09:50:00Z")

</div>

Hello, I’m sorry to bother with such a seemingly trivial problem but I’m stuck with a stupid problem. I have a simple file that I’d like to read. open(path) do f readdlm(f,header=true)\[1\] end where path contain…

---

## [Access StaticArray fields in a StructArray](https://discourse.julialang.org/t/access-staticarray-fields-in-a-structarray/110249)

<div class="topic-metadata">

**Author:** [@sijo](https://discourse.julialang.org/u/sijo)\
**Replies:** 6\
**Last updated:** [February 16, 2024, 8:35am UTC](https://discourse.julialang.org/t/access-staticarray-fields-in-a-structarray/110249 "2024-02-16T08:35:05Z")

</div>

StaticArrays defines properties x, y, z on SVector{3}: using StaticArrays v = SA\[1,2,3\] v.x # returns 1 However these accessors don’t work on StructArrays: using StructArrays A = StructArray(\[v, 2v\]) A.x # gives ERR…

---

## [Errors after an \]update - Precompile fails](https://discourse.julialang.org/t/errors-after-an-update-precompile-fails/35121)

<div class="topic-metadata">

**Author:** [@NicholasWMRitchie](https://discourse.julialang.org/u/NicholasWMRitchie)\
**Replies:** 1\
**Last updated:** [February 16, 2024, 4:19am UTC](https://discourse.julialang.org/t/errors-after-an-update-precompile-fails/35121 "2024-02-16T04:19:49Z")

</div>

I often run into problems updating packages. I think the crux of the problem can be summarized in these two lines. (This often happens when I update packages…) What is going on here? I think that in command 1, I’…

---

## [Performance of \`Meta.parse\` and \`eval\`](https://discourse.julialang.org/t/performance-of-meta-parse-and-eval/52061)

<div class="topic-metadata">

**Author:** [@brucala](https://discourse.julialang.org/u/brucala)\
**Replies:** 11\
**Last updated:** [December 30, 2020, 6:39pm UTC](https://discourse.julialang.org/t/performance-of-meta-parse-and-eval/52061 "2020-12-30T18:39:10Z")

</div>

Hi all, I’m a relatively new and now enthusiastic Julia user. While exploring the metaprogramming capabilities I came to the question of this topic. Probably I am missing something or misinterpreting the use intention f…

---

## [Constructing a let block](https://discourse.julialang.org/t/constructing-a-let-block/110270)

<div class="topic-metadata">

**Author:** [@co1emi11er](https://discourse.julialang.org/u/co1emi11er)\
**Replies:** 3\
**Last updated:** [February 15, 2024, 8:58pm UTC](https://discourse.julialang.org/t/constructing-a-let-block/110270 "2024-02-15T20:58:03Z")

</div>

Can someone help explain why the let block only works up to the second argument? How would I rewrite this to account for all arguments? julia\> a = 4 4 julia\> eval(Expr(:let, :(b = a), :(h = b+2), :(d = b+3))) 6 Thank…

---

## [How to correctly unroll loop in LoopVectorization?](https://discourse.julialang.org/t/how-to-correctly-unroll-loop-in-loopvectorization/110229)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 12\
**Last updated:** [February 15, 2024, 8:47pm UTC](https://discourse.julialang.org/t/how-to-correctly-unroll-loop-in-loopvectorization/110229 "2024-02-15T20:47:01Z")

</div>

Hello! I have made a toy script here, SummaryToy script example using StaticArrays using LoopVectorization using StructArrays using BenchmarkTools struct DimensionalData{D, T} vectors::Tuple{Vararg{Vector{T}, D}}…

---

## [Differentiating through Chebyshev coeff basis](https://discourse.julialang.org/t/differentiating-through-chebyshev-coeff-basis/110234)

<div class="topic-metadata">

**Author:** [@isentropic](https://discourse.julialang.org/u/isentropic)\
**Replies:** 4\
**Last updated:** [February 15, 2024, 8:20pm UTC](https://discourse.julialang.org/t/differentiating-through-chebyshev-coeff-basis/110234 "2024-02-15T20:20:16Z")

</div>

I asked a similar question in slack before and now I have formulated my question much better. Maybe a related issue here chainrules for chebpoly constructors · Issue #10 · JuliaMath/FastChebInterp.jl · GitHub Let’a sa…

---

## [String interpolation formatting](https://discourse.julialang.org/t/string-interpolation-formatting/91454)

<div class="topic-metadata">

**Author:** [@Nathaniel](https://discourse.julialang.org/u/Nathaniel)\
**Replies:** 13\
**Last updated:** [February 15, 2024, 7:52pm UTC](https://discourse.julialang.org/t/string-interpolation-formatting/91454 "2024-02-15T19:52:47Z")

</div>

Consider println("The square root of pi is $(sqrt(pi))") which displays The square root of pi is 1.7724538509055159 How can I change this code if I only want to print the answer to (say) two decimal places? I know t…

---

## [Truncating padded text](https://discourse.julialang.org/t/truncating-padded-text/110256)

<div class="topic-metadata">

**Author:** [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Replies:** 8\
**Last updated:** [February 15, 2024, 7:39pm UTC](https://discourse.julialang.org/t/truncating-padded-text/110256 "2024-02-15T19:39:33Z")

</div>

I’ve often wished that rpad and lpad would truncate to the given width if they’re already wider than n — do we have a function or succinct idiom for that somewhere?

---

## [How to deal with numerical error in tiedrank](https://discourse.julialang.org/t/how-to-deal-with-numerical-error-in-tiedrank/110263)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 2\
**Last updated:** [February 15, 2024, 4:34pm UTC](https://discourse.julialang.org/t/how-to-deal-with-numerical-error-in-tiedrank/110263 "2024-02-15T16:34:50Z")

</div>

Hi all, I would like to account for numerical error in tiedrank from StatsBase. For example, julia\> tiedrank(\[1,1+eps(),3\]) 3-element Vector{Float64}: 1.0 2.0 3.0 I would like the first two elements to be treated a…

---

## [CoCalc.com Demo Thursday 4 pm ET](https://discourse.julialang.org/t/cocalc-com-demo-thursday-4-pm-et/110088)

<div class="topic-metadata">

**Author:** [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Replies:** 2\
**Last updated:** [February 15, 2024, 4:00pm UTC](https://discourse.julialang.org/t/cocalc-com-demo-thursday-4-pm-et/110088 "2024-02-15T16:00:15Z")

</div>

Hello all. We’ve been chatting with Blaec from CoCalc.com about potentially sponsoring JuliaCon 2024 thanks to @cpfiffer : I got a preview in our initial chat, and I thought more of you may be interested to see what i…

---

## [Type instability possibly due to variable playing role of input and output](https://discourse.julialang.org/t/type-instability-possibly-due-to-variable-playing-role-of-input-and-output/110178)

<div class="topic-metadata">

**Author:** [@Nikos\_Gianniotis](https://discourse.julialang.org/u/Nikos_Gianniotis)\
**Replies:** 11\
**Last updated:** [February 15, 2024, 12:43pm UTC](https://discourse.julialang.org/t/type-instability-possibly-due-to-variable-playing-role-of-input-and-output/110178 "2024-02-15T12:43:11Z")

</div>

EDIT: contrary to the title, I have come to the conclusion that the problem lies elsewhere (see post below). Unless this contradicts etiquette, I will not modify the original title, nor the original question below. NEW …

---

## [Debugging segfault when calling versioninfo()](https://discourse.julialang.org/t/debugging-segfault-when-calling-versioninfo/110239)

<div class="topic-metadata">

**Author:** [@paulmelis](https://discourse.julialang.org/u/paulmelis)\
**Replies:** 7\
**Last updated:** [February 15, 2024, 10:35am UTC](https://discourse.julialang.org/t/debugging-segfault-when-calling-versioninfo/110239 "2024-02-15T10:35:18Z")

</div>

I’m having some issues that Julia (1.10.x, both from the official tarball or from juliaup, probably same binary) segfaults when I do a simple versioninfo(). This is on a compute node of an HPC system, so there might be w…

---

## [Box coordinates from image segmentation](https://discourse.julialang.org/t/box-coordinates-from-image-segmentation/109987)

<div class="topic-metadata">

**Author:** [@sardinecan](https://discourse.julialang.org/u/sardinecan)\
**Replies:** 8\
**Last updated:** [February 15, 2024, 9:08am UTC](https://discourse.julialang.org/t/box-coordinates-from-image-segmentation/109987 "2024-02-15T09:08:04Z")

</div>

Hi Everyone, I’m new to the field of image segmentation, and I need your help to find a way of determining the coordinates of a box from image segmentation. I have a batch of images like thie one: I try to find a w…

---

## [Why can't I use \`subtypes\` in a test?](https://discourse.julialang.org/t/why-cant-i-use-subtypes-in-a-test/110235)

<div class="topic-metadata">

**Author:** [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)\
**Replies:** 1\
**Last updated:** [February 15, 2024, 5:25am UTC](https://discourse.julialang.org/t/why-cant-i-use-subtypes-in-a-test/110235 "2024-02-15T05:25:53Z")

</div>

I tried to use the subtypes function in a test, e.g.: using Test @test subtypes(Real) != 0 This works in the REPL, but in a package test this fails with: UndefVarError: \`subtypes\` not defined Can someone explain why…

---

## [Tullio & AxisKeys can dummy variables refer to named keys](https://discourse.julialang.org/t/tullio-axiskeys-can-dummy-variables-refer-to-named-keys/110233)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 0\
**Last updated:** [February 15, 2024, 4:31am UTC](https://discourse.julialang.org/t/tullio-axiskeys-can-dummy-variables-refer-to-named-keys/110233 "2024-02-15T04:31:57Z")

</div>

Is there a more succinct way to do this? ka = KeyedArray( ones(2,2), I=\[:a,:b\], J=\[:x,:y\] ) @tullio x\[i,j\] := ( ka\[i,j\], axiskeys(ka)\[1\]\[i\], axiskeys(ka)\[2\]\[j\]) Something like @tullio x\[i,j\] := ( ka(i,j), i, j ) T…

---

## [Function definition inside let-block impacting performance?](https://discourse.julialang.org/t/function-definition-inside-let-block-impacting-performance/110007)

<div class="topic-metadata">

**Author:** [@JuhaHeiskala](https://discourse.julialang.org/u/JuhaHeiskala)\
**Replies:** 42\
**Last updated:** [February 14, 2024, 10:18pm UTC](https://discourse.julialang.org/t/function-definition-inside-let-block-impacting-performance/110007 "2024-02-14T22:18:36Z")

</div>

Is there some reason why a function defined inside a let-block is slower compared to defining the same function in global scope? e.g. below recursive Fibonacci (from the old Julia microbenchmarks) is 10 times slower if …

---

## [Conversion and promotion](https://discourse.julialang.org/t/conversion-and-promotion/110217)

<div class="topic-metadata">

**Author:** [@hros](https://discourse.julialang.org/u/hros)\
**Replies:** 2\
**Last updated:** [February 14, 2024, 9:54pm UTC](https://discourse.julialang.org/t/conversion-and-promotion/110217 "2024-02-14T21:54:06Z")

</div>

While working on an exercise on exercism, I found myself struggling with the issue of conversion and promotion. The exercise called for implementing a user-defined type for complex numbers. Defining the type and the mat…

---

## [Change "current working module" from REPL](https://discourse.julialang.org/t/change-current-working-module-from-repl/53166)

<div class="topic-metadata">

**Author:** [@cscherrer](https://discourse.julialang.org/u/cscherrer)\
**Replies:** 6\
**Last updated:** [February 14, 2024, 8:26pm UTC](https://discourse.julialang.org/t/change-current-working-module-from-repl/53166 "2024-02-14T20:26:42Z")

</div>

In package development, I often find myself needing to bring lots of things into scope, so I can run bits and pieces as if my package were running them. Something like julia\> using Foo # or some package I'm developing j…

---

## [How to pass a matrix free preconditioner to IterativeSolver of KrylovKit?](https://discourse.julialang.org/t/how-to-pass-a-matrix-free-preconditioner-to-iterativesolver-of-krylovkit/63315)

<div class="topic-metadata">

**Author:** [@FredericN](https://discourse.julialang.org/u/FredericN)\
**Replies:** 6\
**Last updated:** [February 14, 2024, 8:04pm UTC](https://discourse.julialang.org/t/how-to-pass-a-matrix-free-preconditioner-to-iterativesolver-of-krylovkit/63315 "2024-02-14T20:04:54Z")

</div>

Say I have a matrix A and a linear function P that takes as argument a vector and returns a vector of the same size. How can I use a preconditioned conjugate gradient from IterativeSolver.jl of KrylovKit.jl for solving A…

---

## [Bind values from multiple HTML fields in Pluto](https://discourse.julialang.org/t/bind-values-from-multiple-html-fields-in-pluto/110022)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 4\
**Last updated:** [February 14, 2024, 7:05pm UTC](https://discourse.julialang.org/t/bind-values-from-multiple-html-fields-in-pluto/110022 "2024-02-14T19:05:54Z")

</div>

Hello, I would like to organize a grid of number fields in a cell and assign each input to a different julia variable (or perhaps a dictionary). What is the best way to do that? I attached example code below. Thank you…

---

## [Time Dependent Linear Map](https://discourse.julialang.org/t/time-dependent-linear-map/110192)

<div class="topic-metadata">

**Author:** [@leespen1](https://discourse.julialang.org/u/leespen1)\
**Replies:** 5\
**Last updated:** [February 14, 2024, 5:43pm UTC](https://discourse.julialang.org/t/time-dependent-linear-map/110192 "2024-02-14T17:43:04Z")

</div>

I am trying to implement an initial problem. Let the system of ODEs be \\frac{d\\vec{y}}{dt} = A(t;\\vec{\\theta})\\vec{y}, \\quad \\vec{y}(0) = \\vec{y}\_0, \\quad 0 \\leq t \\leq T. The matrix A depends on the time t, as well a…

---

## [Possible compiler issue with enzyme and custom data type](https://discourse.julialang.org/t/possible-compiler-issue-with-enzyme-and-custom-data-type/110125)

<div class="topic-metadata">

**Author:** [@jwalker](https://discourse.julialang.org/u/jwalker)\
**Replies:** 6\
**Last updated:** [February 14, 2024, 5:30pm UTC](https://discourse.julialang.org/t/possible-compiler-issue-with-enzyme-and-custom-data-type/110125 "2024-02-14T17:30:52Z")

</div>

I had some tests for a custom data type that were working last Friday. Now, one test doesn’t work, and I’m very confused about what changed. I suspect that there might be an issue with Enzyme and the compiler. I don’t h…

---

## [Constrained partitions of 1:K](https://discourse.julialang.org/t/constrained-partitions-of-1-k/109952)

<div class="topic-metadata">

**Author:** [@clempe](https://discourse.julialang.org/u/clempe)\
**Replies:** 2\
**Last updated:** [February 14, 2024, 3:37pm UTC](https://discourse.julialang.org/t/constrained-partitions-of-1-k/109952 "2024-02-14T15:37:46Z")

</div>

i’m trying to find all partitions of 1:K that satisfy some criteria: take all partitions so that there are n subsets of size 2, h subsets of size 3, and all other subsets singletons. I can probably come up with somethi…

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

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