# General Usage

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

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

**Page:** 442

---

## [Question about two variables?](https://discourse.julialang.org/t/question-about-two-variables/82094)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 6\
**Last updated:** [June 1, 2022, 11:45pm UTC](https://discourse.julialang.org/t/question-about-two-variables/82094 "2022-06-01T23:45:15Z")

</div>

Dear all, What is the difference between foo and bar below? julia\> foo = \[1, 2, 3\] 3-element Vector{Int64}: 1 2 3 julia\> bar = \[1; 2; 3\] 3-element Vector{Int64}: 1 2 3 julia\> foo === bar false julia\> varinfo()…

---

## [Question about Foo or foo?](https://discourse.julialang.org/t/question-about-foo-or-foo/82091)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 3\
**Last updated:** [June 1, 2022, 11:10pm UTC](https://discourse.julialang.org/t/question-about-foo-or-foo/82091 "2022-06-01T23:10:33Z")

</div>

Dear all, I am new to Julia. And I often see many people using Foo or foo in their codes. So what does Foo or foo mean? Why so many people like to use it?

---

## [How to count heap allocations easily?](https://discourse.julialang.org/t/how-to-count-heap-allocations-easily/68285)

<div class="topic-metadata">

**Author:** [@JeffFessler](https://discourse.julialang.org/u/JeffFessler)\
**Replies:** 4\
**Last updated:** [June 1, 2022, 10:31pm UTC](https://discourse.julialang.org/t/how-to-count-heap-allocations-easily/68285 "2022-06-01T22:31:52Z")

</div>

The manual recommends using @time and @allocated to examine memory use: https://docs.julialang.org/en/v1/manual/profile/#Memory-allocation-analysis It appears that both of those macros measure both stack and heap alloc…

---

## [Precompute some values of a function](https://discourse.julialang.org/t/precompute-some-values-of-a-function/82079)

<div class="topic-metadata">

**Author:** [@raphaelchinchilla](https://discourse.julialang.org/u/raphaelchinchilla)\
**Replies:** 7\
**Last updated:** [June 1, 2022, 8:46pm UTC](https://discourse.julialang.org/t/precompute-some-values-of-a-function/82079 "2022-06-01T20:46:20Z")

</div>

Consider the following MWE: d=rand(10^8); f(x,d) = x + sum(d) g(x) = f(x,d) If I run @benchmark f(1,d) and @benchmark g(1) (in the REPL), both take the same amount of time to run (which is what I kind of excepted). Is …

---

## [Is it possible to have multiple Manifest.toml files for the same project, corresponding to different Julia versions?](https://discourse.julialang.org/t/is-it-possible-to-have-multiple-manifest-toml-files-for-the-same-project-corresponding-to-different-julia-versions/82064)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 3\
**Last updated:** [June 1, 2022, 8:00pm UTC](https://discourse.julialang.org/t/is-it-possible-to-have-multiple-manifest-toml-files-for-the-same-project-corresponding-to-different-julia-versions/82064 "2022-06-01T20:00:18Z")

</div>

I am testing my code on julia 1.8 parallelly with 1.7, and instantiating the environment on 1.8 gives me a warning that the packages have been resolved using julia 1.7, which might lead to unpredictable results. On the o…

---

## [Can't install any packages at all](https://discourse.julialang.org/t/cant-install-any-packages-at-all/82076)

<div class="topic-metadata">

**Author:** [@Vitali1sParadox](https://discourse.julialang.org/u/Vitali1sParadox)\
**Replies:** 0\
**Last updated:** [June 1, 2022, 7:20pm UTC](https://discourse.julialang.org/t/cant-install-any-packages-at-all/82076 "2022-06-01T19:20:19Z")

</div>

Hey guys, I had been using Julia on Ubuntu 21.10 with a good experience until I just switched to OpenSUSE Tumbleweed a few days ago, that I don’t want to explain more detailed. I want to run Julia as a kernel n VSCode o…

---

## [How does Eirene deal with unconnected nodes when using the distance matrix input?](https://discourse.julialang.org/t/how-does-eirene-deal-with-unconnected-nodes-when-using-the-distance-matrix-input/81941)

<div class="topic-metadata">

**Author:** [@MariaBras](https://discourse.julialang.org/u/MariaBras)\
**Replies:** 1\
**Last updated:** [June 1, 2022, 5:56pm UTC](https://discourse.julialang.org/t/how-does-eirene-deal-with-unconnected-nodes-when-using-the-distance-matrix-input/81941 "2022-06-01T17:56:05Z")

</div>

Hi, I’m new to Julia, and I’m trying to use Eirene to perform persistent homology on a (not directed, not weighted) network, plot the persistence barcode and diagrams. I use the distance matrix from csv input option. I…

---

## [Julia Artifact Download Problem: How to tell Julia to follow 301-redirected downloads?](https://discourse.julialang.org/t/julia-artifact-download-problem-how-to-tell-julia-to-follow-301-redirected-downloads/82003)

<div class="topic-metadata">

**Author:** [@braza2](https://discourse.julialang.org/u/braza2)\
**Replies:** 9\
**Last updated:** [June 1, 2022, 2:04pm UTC](https://discourse.julialang.org/t/julia-artifact-download-problem-how-to-tell-julia-to-follow-301-redirected-downloads/82003 "2022-06-01T14:04:08Z")

</div>

Hi, as some other fellow Julia users I want to use Julia behind a corporate firewall which in some cases intercepts downloads, analyzes the content and then downloads the files. Therefore in the beginning I was not able…

---

## [Remove leading zeros from string to int](https://discourse.julialang.org/t/remove-leading-zeros-from-string-to-int/82048)

<div class="topic-metadata">

**Author:** [@Billpete002](https://discourse.julialang.org/u/Billpete002)\
**Replies:** 1\
**Last updated:** [June 1, 2022, 11:43am UTC](https://discourse.julialang.org/t/remove-leading-zeros-from-string-to-int/82048 "2022-06-01T11:43:40Z")

</div>

So my data looks like: Stay Duration string3? ------- 001 012 missing 002 What I would like is someway to convert these to Int: Stay Duration Int64 ------- 1 12 missing 2 My normal method of converting a string to in…

---

## [Just cleaned up 17G of registries](https://discourse.julialang.org/t/just-cleaned-up-17g-of-registries/82049)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 0\
**Last updated:** [June 1, 2022, 10:51am UTC](https://discourse.julialang.org/t/just-cleaned-up-17g-of-registries/82049 "2022-06-01T10:51:08Z")

</div>

Until today, running Pkg.update() each time took nearly 2 minutes just for the step “Updating registry” on my laptop. I thought this was the case for all Julia users, until I found some discussions on this issue after se…

---

## [How to improve type-inference in Folds.map?](https://discourse.julialang.org/t/how-to-improve-type-inference-in-folds-map/82040)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 0\
**Last updated:** [June 1, 2022, 8:59am UTC](https://discourse.julialang.org/t/how-to-improve-type-inference-in-folds-map/82040 "2022-06-01T08:59:33Z")

</div>

Eg julia\> @code\_warntype Folds.map(1:10) do i i^2 end MethodInstance for Folds.map(::var"#3#4", ::UnitRange{Int64}) from map(f, itr; kwargs...) in Folds.Implementations at /home/jishnu/.julia/packages/Fo…

---

## [Understanding message passing with pmap](https://discourse.julialang.org/t/understanding-message-passing-with-pmap/82030)

<div class="topic-metadata">

**Author:** [@swishmas](https://discourse.julialang.org/u/swishmas)\
**Replies:** 3\
**Last updated:** [June 1, 2022, 6:38am UTC](https://discourse.julialang.org/t/understanding-message-passing-with-pmap/82030 "2022-06-01T06:38:53Z")

</div>

I was trying to understand the behaviour of pmap and how vectors are updated inside of a generic function call. I wanted to know if new variables were being constantly created in pmap and whether this was truly efficient…

---

## [Annotating global variable's type (v1.8) but only known at runtime](https://discourse.julialang.org/t/annotating-global-variables-type-v1-8-but-only-known-at-runtime/82016)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 1\
**Last updated:** [June 1, 2022, 2:09am UTC](https://discourse.julialang.org/t/annotating-global-variables-type-v1-8-but-only-known-at-runtime/82016 "2022-06-01T02:09:32Z")

</div>

I’m thinking about how in v1.8 you can annotate a global variable with a fixed type e.g. a::Int = 4. Is there a way to specify the variable has a fixed type but it’s inferred from the runtime value at assignment? It happ…

---

## [Passing a Ptr{Ptr{Int64}} in ccall](https://discourse.julialang.org/t/passing-a-ptr-ptr-int64-in-ccall/82018)

<div class="topic-metadata">

**Author:** [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Replies:** 3\
**Last updated:** [June 1, 2022, 12:45am UTC](https://discourse.julialang.org/t/passing-a-ptr-ptr-int64-in-ccall/82018 "2022-06-01T00:45:50Z")

</div>

I have gone down a rabbit hole after reading https://github.com/lh3/biofast and somehow have ended up writing an interface to the C code in cgranges. A couple of the functions that I want to call through ccall take an a…

---

## [For each row, return n lowest column indexes or column names](https://discourse.julialang.org/t/for-each-row-return-n-lowest-column-indexes-or-column-names/81932)

<div class="topic-metadata">

**Author:** [@Snowy](https://discourse.julialang.org/u/Snowy)\
**Replies:** 2\
**Last updated:** [May 31, 2022, 11:41pm UTC](https://discourse.julialang.org/t/for-each-row-return-n-lowest-column-indexes-or-column-names/81932 "2022-05-31T23:41:59Z")

</div>

Hi all, New to Julia and seeking a little help. I am working with a dataframe and for each row, I want to return either the position of the lowest n values, or the column names of the lowest n value. The package DataStr…

---

## [Using using SetField.jl to replace all fields matching a predicate](https://discourse.julialang.org/t/using-using-setfield-jl-to-replace-all-fields-matching-a-predicate/81977)

<div class="topic-metadata">

**Author:** [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Replies:** 5\
**Last updated:** [May 31, 2022, 10:34pm UTC](https://discourse.julialang.org/t/using-using-setfield-jl-to-replace-all-fields-matching-a-predicate/81977 "2022-05-31T22:34:47Z")

</div>

I have a heavily nested type. Somewhere about 7 or 9 layers of composition down there is are some number of fields that match the should\_replace predicate: should\_replace(::Any) = false should\_replace(x::Foo) = x.bar \>…

---

## [How to change/reduce vector of Structure to be a structure of aggregated fields?](https://discourse.julialang.org/t/how-to-change-reduce-vector-of-structure-to-be-a-structure-of-aggregated-fields/78032)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 8\
**Last updated:** [March 18, 2022, 4:53pm UTC](https://discourse.julialang.org/t/how-to-change-reduce-vector-of-structure-to-be-a-structure-of-aggregated-fields/78032 "2022-03-18T16:53:42Z")

</div>

I have a file that I can read from it a specific structure Rs and its instance R (a simple MWE of it is below) using LinearAlgebra, Parameters, Base Base.@kwdef mutable struct Rs I::Vector{Float64} = \[2,2,2\] Dot…

---

## [Reconstructing warning when dealing with Module?](https://discourse.julialang.org/t/reconstructing-warning-when-dealing-with-module/78363)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 5\
**Last updated:** [March 24, 2022, 1:45pm UTC](https://discourse.julialang.org/t/reconstructing-warning-when-dealing-with-module/78363 "2022-03-24T13:45:11Z")

</div>

I am using createSim.jl to save an instance Sim of structure Simulation in .jld2 file, and readSim.jl to read this instance. However, I am having reconstructing. How to solve it please? createSim.jl is: using JLD2 Base…

---

## [Plotting from Debugger.jl?](https://discourse.julialang.org/t/plotting-from-debugger-jl/82006)

<div class="topic-metadata">

**Author:** [@johnomotani](https://discourse.julialang.org/u/johnomotani)\
**Replies:** 2\
**Last updated:** [May 31, 2022, 7:49pm UTC](https://discourse.julialang.org/t/plotting-from-debugger-jl/82006 "2022-05-31T19:49:42Z")

</div>

Inside a debugging session with Debugger.jl, is it possible to display plots (I’m currently using Plots.jl, but willing to use any package) from the julia prompt? I can save the plots to disk, but it would be nice to jus…

---

## [Radionuclide database / multi-table](https://discourse.julialang.org/t/radionuclide-database-multi-table/80935)

<div class="topic-metadata">

**Author:** [@skypuppy](https://discourse.julialang.org/u/skypuppy)\
**Replies:** 8\
**Last updated:** [May 31, 2022, 7:42pm UTC](https://discourse.julialang.org/t/radionuclide-database-multi-table/80935 "2022-05-31T19:42:22Z")

</div>

I’m looking for a package / dataset of radionuclides that includes things like atomic weight, methods of decay, energies of the decay(s), half-lifes, and such like. I’d like to be able to pick an element, see it’s nucli…

---

## [Help with increasing performance in badly coded functions](https://discourse.julialang.org/t/help-with-increasing-performance-in-badly-coded-functions/81918)

<div class="topic-metadata">

**Author:** [@mauri5566](https://discourse.julialang.org/u/mauri5566)\
**Replies:** 5\
**Last updated:** [May 31, 2022, 6:27pm UTC](https://discourse.julialang.org/t/help-with-increasing-performance-in-badly-coded-functions/81918 "2022-05-31T18:27:18Z")

</div>

Hi guys, I need a little help with optimising the performance of a few functions. If you need a more detailed access to my project here’s a notebook (Largrids.jl/largrid.ipynb at main · adelloste/Largrids.jl · GitHub) th…

---

## [Question about CSV.jl](https://discourse.julialang.org/t/question-about-csv-jl/81998)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 9\
**Last updated:** [May 31, 2022, 6:14pm UTC](https://discourse.julialang.org/t/question-about-csv-jl/81998 "2022-05-31T18:14:04Z")

</div>

What’s wrong with this problem? julia\> versioninfo() Julia Version 1.7.3 Commit 742b9abb4d (2022-05-06 12:58 UTC) Platform Info: OS: macOS (x86\_64-apple-darwin21.4.0) CPU: Apple M1 WORD\_SIZE: 64 LIBM: libopenlib…

---

## [Usage TaylorSeries.jl in to packages with different settings](https://discourse.julialang.org/t/usage-taylorseries-jl-in-to-packages-with-different-settings/81191)

<div class="topic-metadata">

**Author:** [@Tomas\_Radlicka](https://discourse.julialang.org/u/Tomas_Radlicka)\
**Replies:** 3\
**Last updated:** [May 31, 2022, 4:49pm UTC](https://discourse.julialang.org/t/usage-taylorseries-jl-in-to-packages-with-different-settings/81191 "2022-05-31T16:49:52Z")

</div>

I am using the TaylorSeries.jl in two independent packages (let’s say A.jl and B.jl), but I use them in one project. The TaylorSeries.jl in A.jl is initialized as: using TaylorSeries function \_\_init\_\_() set\_variabl…

---

## [View package dependency graph](https://discourse.julialang.org/t/view-package-dependency-graph/50199)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 1\
**Last updated:** [May 31, 2022, 3:37pm UTC](https://discourse.julialang.org/t/view-package-dependency-graph/50199 "2022-05-31T15:37:34Z")

</div>

Is there a way to generate a tree of my package dependencies that I can look at?

---

## [Question about install packages from GitHub?](https://discourse.julialang.org/t/question-about-install-packages-from-github/81993)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 4\
**Last updated:** [May 31, 2022, 2:38pm UTC](https://discourse.julialang.org/t/question-about-install-packages-from-github/81993 "2022-05-31T14:38:47Z")

</div>

Dear all, how can I install the packages in GitHub . For example, I want to add “DataFramesMeta”(dev version) . If I run \] add DataFramesMeta, it always add the version 0.7.1.

---

## [Anonymous function performance](https://discourse.julialang.org/t/anonymous-function-performance/81972)

<div class="topic-metadata">

**Author:** [@jerry\_ji](https://discourse.julialang.org/u/jerry_ji)\
**Replies:** 9\
**Last updated:** [May 31, 2022, 1:50pm UTC](https://discourse.julialang.org/t/anonymous-function-performance/81972 "2022-05-31T13:50:19Z")

</div>

Hi all, Following code shows performance penalty associate with anonymous function. However the @code\_llvm shows both code is the same. Am I benchmark it in a wrong way? using BenchmarkTools f1(x)=5+6x f2(x)=7+8x f…

---

## [PackageCompiler.jl "Warning: it is not recommended to create an app/library without a preexisting manifest"](https://discourse.julialang.org/t/packagecompiler-jl-warning-it-is-not-recommended-to-create-an-app-library-without-a-preexisting-manifest/81942)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 3\
**Last updated:** [May 31, 2022, 1:19pm UTC](https://discourse.julialang.org/t/packagecompiler-jl-warning-it-is-not-recommended-to-create-an-app-library-without-a-preexisting-manifest/81942 "2022-05-31T13:19:45Z")

</div>

What does this warning mean? PackageCompiler.create\_app("MyPackage", "MyPackageApp", precompile\_execution\_file="MyPackage/precompile.jl", force=true) ┌ Warning: it is not recommended to create an app/library without a p…

---

## [Get return type with given parameters](https://discourse.julialang.org/t/get-return-type-with-given-parameters/81986)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 1\
**Last updated:** [May 31, 2022, 1:05pm UTC](https://discourse.julialang.org/t/get-return-type-with-given-parameters/81986 "2022-05-31T13:05:41Z")

</div>

Hi all :slight\_smile: Is there a function to compute the return type from given parameters/ parameter types? Cheers

---

## [Julia multithreading no performance improvement](https://discourse.julialang.org/t/julia-multithreading-no-performance-improvement/81957)

<div class="topic-metadata">

**Author:** [@111](https://discourse.julialang.org/u/111)\
**Replies:** 15\
**Last updated:** [May 31, 2022, 11:55am UTC](https://discourse.julialang.org/t/julia-multithreading-no-performance-improvement/81957 "2022-05-31T11:55:44Z")

</div>

please refer to the 5th post in English.

---

## [Optionally multi threaded for loop](https://discourse.julialang.org/t/optionally-multi-threaded-for-loop/81902)

<div class="topic-metadata">

**Author:** [@this\_josh](https://discourse.julialang.org/u/this_josh)\
**Replies:** 9\
**Last updated:** [May 31, 2022, 10:14am UTC](https://discourse.julialang.org/t/optionally-multi-threaded-for-loop/81902 "2022-05-31T10:14:32Z")

</div>

I have a function which contains a loop which should normally be run multi threaded using Threads.@threads, but sometimes I want to run it single threaded. function foo(multi\_thread=true) mt = multi\_thread ? Threads…

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

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