# General Usage

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

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

**Page:** 456

---

## [Map over combinations of parameters, and grouping results as DataFrame](https://discourse.julialang.org/t/map-over-combinations-of-parameters-and-grouping-results-as-dataframe/77306)

<div class="topic-metadata">

**Author:** [@baptnz](https://discourse.julialang.org/u/baptnz)\
**Replies:** 10\
**Last updated:** [April 29, 2022, 10:55pm UTC](https://discourse.julialang.org/t/map-over-combinations-of-parameters-and-grouping-results-as-dataframe/77306 "2022-04-29T22:55:43Z")

</div>

Coming from the R world, I’m wondering how to translate the following task in a more Julian way. I often need to run a function, say my\_model(x, a, b, c) for various combinations of parameters a,b,c, where the output of m…

---

## [Fastest way to parse a string of numbers](https://discourse.julialang.org/t/fastest-way-to-parse-a-string-of-numbers/16720)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 21\
**Last updated:** [April 29, 2022, 9:07pm UTC](https://discourse.julialang.org/t/fastest-way-to-parse-a-string-of-numbers/16720 "2022-04-29T21:07:44Z")

</div>

I have a string of space separated numbers like this: "1.0 2.34345 7.9" And I want to parse it. Currently I use the following code for this: function parse\_numbers(s) pieces = split(s, ' ', keepemp…

---

## [Performance of resize! vs pre-allocating with zeros(...)](https://discourse.julialang.org/t/performance-of-resize-vs-pre-allocating-with-zeros/80258)

<div class="topic-metadata">

**Author:** [@fcdimitr](https://discourse.julialang.org/u/fcdimitr)\
**Replies:** 9\
**Last updated:** [April 29, 2022, 8:28pm UTC](https://discourse.julialang.org/t/performance-of-resize-vs-pre-allocating-with-zeros/80258 "2022-04-29T20:28:18Z")

</div>

I observe a factor of 5x time difference in writing over a vector with two different preallocation strategies. Using x = zeros(Int64, n) Using x = Int64\[\]; resize!(x,n) The benchmark code is bellow using BenchmarkT…

---

## [Strange behavior in defining function](https://discourse.julialang.org/t/strange-behavior-in-defining-function/80271)

<div class="topic-metadata">

**Author:** [@neujmin1](https://discourse.julialang.org/u/neujmin1)\
**Replies:** 3\
**Last updated:** [April 29, 2022, 8:19pm UTC](https://discourse.julialang.org/t/strange-behavior-in-defining-function/80271 "2022-04-29T20:19:38Z")

</div>

Had a “gotcha” that I don’t understand the behavior of. Bug maybe, or am I missing something here?? Here’s a simplified code example… “”" function foo() wookie = false f(x) = 5 if wookie println("wookie acti…

---

## [Providing context to @test macro](https://discourse.julialang.org/t/providing-context-to-test-macro/80235)

<div class="topic-metadata">

**Author:** [@col16](https://discourse.julialang.org/u/col16)\
**Replies:** 6\
**Last updated:** [April 29, 2022, 6:09pm UTC](https://discourse.julialang.org/t/providing-context-to-test-macro/80235 "2022-04-29T18:09:04Z")

</div>

I’m using Julia to test the integrity of a large dataset by re-calculating values at random locations and checking that they match. When a test that was run using the @test macro fails, it reports what was evaluated (an…

---

## [Pkg: Proxy Authentication Required (Received HTTP code 407 from proxy after CONNECT)](https://discourse.julialang.org/t/pkg-proxy-authentication-required-received-http-code-407-from-proxy-after-connect/79984)

<div class="topic-metadata">

**Author:** [@Keluaa](https://discourse.julialang.org/u/Keluaa)\
**Replies:** 2\
**Last updated:** [April 29, 2022, 2:32pm UTC](https://discourse.julialang.org/t/pkg-proxy-authentication-required-received-http-code-407-from-proxy-after-connect/79984 "2022-04-29T14:32:33Z")

</div>

Hello, I am currently working with Julia 1.7.2 on a linux machine through ssh which requires a proxy to access the internet. By configuring the environment variables “http\_proxy” and “https\_proxy” to http://usr:@some\_a…

---

## [The best way to pass intermediate value to auxiliary functions](https://discourse.julialang.org/t/the-best-way-to-pass-intermediate-value-to-auxiliary-functions/80254)

<div class="topic-metadata">

**Author:** [@wujinq](https://discourse.julialang.org/u/wujinq)\
**Replies:** 2\
**Last updated:** [April 29, 2022, 2:19pm UTC](https://discourse.julialang.org/t/the-best-way-to-pass-intermediate-value-to-auxiliary-functions/80254 "2022-04-29T14:19:15Z")

</div>

I’m writing a Monte Carlo program and I need a lot of auxiliary function dependent on one or two fields of the parameter model of the main function sweep!(model) in the following way: function sweep!(model, n\_sweep) …

---

## [Linear model with categorical variable](https://discourse.julialang.org/t/linear-model-with-categorical-variable/80201)

<div class="topic-metadata">

**Author:** [@rkube](https://discourse.julialang.org/u/rkube)\
**Replies:** 2\
**Last updated:** [April 29, 2022, 10:17am UTC](https://discourse.julialang.org/t/linear-model-with-categorical-variable/80201 "2022-04-29T10:17:05Z")

</div>

Hi, I’m trying to implement a linear model with a categorical variable in turing but am stuck. The model has a different μ, depending on whether S=0 or S=1: Wᵢ ~ Normal(μᵢ, σ) μᵢ = α\_S\[i\] α = \[α1, α2\] Priors: αᵢ ~ …

---

## [How to understand the ProfileView output](https://discourse.julialang.org/t/how-to-understand-the-profileview-output/79968)

<div class="topic-metadata">

**Author:** [@Himbeersternchen](https://discourse.julialang.org/u/Himbeersternchen)\
**Replies:** 3\
**Last updated:** [April 29, 2022, 9:52am UTC](https://discourse.julialang.org/t/how-to-understand-the-profileview-output/79968 "2022-04-29T09:52:54Z")

</div>

Hello Everyone, Similar as this topic, i want to understand the profileview output. The test code is as Following: init() = begin n = 250 a1 = Vector{Vector{Float64}}(undef, n) for i in 1:n a1\[i\] …

---

## [Convert Symbolic expression to a function](https://discourse.julialang.org/t/convert-symbolic-expression-to-a-function/80225)

<div class="topic-metadata">

**Author:** [@Jack](https://discourse.julialang.org/u/Jack)\
**Replies:** 5\
**Last updated:** [April 29, 2022, 8:57am UTC](https://discourse.julialang.org/t/convert-symbolic-expression-to-a-function/80225 "2022-04-29T08:57:13Z")

</div>

Greetings. I am trying to convert the a very simple example of the following using SymbolicUtils @syms x f = 2\*x the f into a function that would evaluate at a concrete number of x, so ideally it’s a function that has …

---

## [Improve performance of CRRA utility function](https://discourse.julialang.org/t/improve-performance-of-crra-utility-function/80229)

<div class="topic-metadata">

**Author:** [@fredrikpaues](https://discourse.julialang.org/u/fredrikpaues)\
**Replies:** 6\
**Last updated:** [April 29, 2022, 8:28am UTC](https://discourse.julialang.org/t/improve-performance-of-crra-utility-function/80229 "2022-04-29T08:28:26Z")

</div>

I want to improve the performance of u in the code below. I have tried rewriting the formula and inlining the broadcasting, which helped some. But when tried using @turbo from LoopVectorization.jl something goes wrong an…

---

## [Data Storage Quo Vadis under Julia: HDF5 - JLD2 - MAT -](https://discourse.julialang.org/t/data-storage-quo-vadis-under-julia-hdf5-jld2-mat/80159)

<div class="topic-metadata">

**Author:** [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Replies:** 0\
**Last updated:** [April 27, 2022, 5:35pm UTC](https://discourse.julialang.org/t/data-storage-quo-vadis-under-julia-hdf5-jld2-mat/80159 "2022-04-27T17:35:45Z")

</div>

The good news: Julia can beat the phyton data-compression package “hdf5storage”. But it is useful to have a closer look into the matter. And, if you store data, it should be better or at least as good as hdf5storage. …

---

## [Do AutoMerge of Julia Registry and CI use the same package compatibility rule?](https://discourse.julialang.org/t/do-automerge-of-julia-registry-and-ci-use-the-same-package-compatibility-rule/80238)

<div class="topic-metadata">

**Author:** [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Replies:** 0\
**Last updated:** [April 29, 2022, 2:20am UTC](https://discourse.julialang.org/t/do-automerge-of-julia-registry-and-ci-use-the-same-package-compatibility-rule/80238 "2022-04-29T02:20:47Z")

</div>

I am very puzzled by the behavior of AutoMerge process of the Julia Registry. I had difficulty registering my updated version of the package GitHub - UCD4IDS/MultiscaleGraphSignalTransforms.jl: MultiscaleGraphSignalTran…

---

## [Performance of for loop vs. broadcast](https://discourse.julialang.org/t/performance-of-for-loop-vs-broadcast/80211)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 8\
**Last updated:** [April 28, 2022, 8:59pm UTC](https://discourse.julialang.org/t/performance-of-for-loop-vs-broadcast/80211 "2022-04-28T20:59:15Z")

</div>

In scaling a vector I tried a number of implementations to determine the best performance. Initially I implemented it with global variables and a for loop. Then reading the performance tips (and discourse) I realized t…

---

## [Tier 1 support: E.g. why isn't Windows supported for 32-bit?](https://discourse.julialang.org/t/tier-1-support-e-g-why-isnt-windows-supported-for-32-bit/80219)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 5\
**Last updated:** [April 28, 2022, 5:01pm UTC](https://discourse.julialang.org/t/tier-1-support-e-g-why-isnt-windows-supported-for-32-bit/80219 "2022-04-28T17:01:19Z")

</div>

Julia supports 32-bit (on Linux with tier 1 support). I’m just curious, why not on Windows. E.g. Windows 10 supports 32-bit (but not Windows 11). Are there any tests know to fail? Is it just an oversight, and can be giv…

---

## [Symbol not found when importing Fortran library within custom Package](https://discourse.julialang.org/t/symbol-not-found-when-importing-fortran-library-within-custom-package/80063)

<div class="topic-metadata">

**Author:** [@cjproud](https://discourse.julialang.org/u/cjproud)\
**Replies:** 3\
**Last updated:** [April 28, 2022, 4:38pm UTC](https://discourse.julialang.org/t/symbol-not-found-when-importing-fortran-library-within-custom-package/80063 "2022-04-28T16:38:10Z")

</div>

I’m importing compiled Fortran code as a shared library within a custom package I have created. However, when I call a Fortran function from my module within Python using JuliaCall (GitHub - cjdoris/PythonCall.jl: Python…

---

## [Submodules accessing global variables in Parent module](https://discourse.julialang.org/t/submodules-accessing-global-variables-in-parent-module/80164)

<div class="topic-metadata">

**Author:** [@tom-plaa](https://discourse.julialang.org/u/tom-plaa)\
**Replies:** 4\
**Last updated:** [April 28, 2022, 4:00pm UTC](https://discourse.julialang.org/t/submodules-accessing-global-variables-in-parent-module/80164 "2022-04-28T16:00:29Z")

</div>

How can we make a submodule access a variable defined in its parent module? Sorry if this is a really basic question, but I’ve spent almost an hour looking for an answer without any success. I have only seen how to acce…

---

## [Alllocations in a reduction over a Tuple](https://discourse.julialang.org/t/alllocations-in-a-reduction-over-a-tuple/80083)

<div class="topic-metadata">

**Author:** [@ademonts](https://discourse.julialang.org/u/ademonts)\
**Replies:** 2\
**Last updated:** [April 28, 2022, 1:29pm UTC](https://discourse.julialang.org/t/alllocations-in-a-reduction-over-a-tuple/80083 "2022-04-28T13:29:06Z")

</div>

I’m trying to make a recursive reduction over a Tuple that calculates the inverse of the reduction of a nested Tuple everytime it encounters one. I.e. for x=(1,(2,3)), foo(x) should compute f(1)+\\frac{1}{f(2)+f(3)}. The …

---

## [How to best use DistributedArray.jl](https://discourse.julialang.org/t/how-to-best-use-distributedarray-jl/79848)

<div class="topic-metadata">

**Author:** [@ultrapoci](https://discourse.julialang.org/u/ultrapoci)\
**Replies:** 1\
**Last updated:** [April 28, 2022, 1:16pm UTC](https://discourse.julialang.org/t/how-to-best-use-distributedarray-jl/79848 "2022-04-28T13:16:38Z")

</div>

I have a couple of questions about Distributed arrays. I have to simulate a lattice, and for every point of this lattice I have to save a collection of matrices. This is because I’m interested in the links connecting e…

---

## [How do I avoid subtypes when building a type lookup for parsing?](https://discourse.julialang.org/t/how-do-i-avoid-subtypes-when-building-a-type-lookup-for-parsing/80198)

<div class="topic-metadata">

**Author:** [@feanor12](https://discourse.julialang.org/u/feanor12)\
**Replies:** 0\
**Last updated:** [April 28, 2022, 10:07am UTC](https://discourse.julialang.org/t/how-do-i-avoid-subtypes-when-building-a-type-lookup-for-parsing/80198 "2022-04-28T10:07:41Z")

</div>

I read in a csv file and I want to generate types based on the content. My idea was to build a lookup dictionary for this, however the subtypes function only exists in InteractiveUtils.jl. I would like to avoid includin…

---

## [Best practice for argument type declarations?](https://discourse.julialang.org/t/best-practice-for-argument-type-declarations/80194)

<div class="topic-metadata">

**Author:** [@dnldlg](https://discourse.julialang.org/u/dnldlg)\
**Replies:** 1\
**Last updated:** [April 28, 2022, 9:33am UTC](https://discourse.julialang.org/t/best-practice-for-argument-type-declarations/80194 "2022-04-28T09:33:31Z")

</div>

Hi all, I started learning Julia a few days ago and was wondering what the recommended coding practice is with regard to argument type declarations. I witnessed some people on stackoverflow saying it is “nonesense” to ex…

---

## [How to loop over the key/value pairs of a NamedTuple?](https://discourse.julialang.org/t/how-to-loop-over-the-key-value-pairs-of-a-namedtuple/5470)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 8\
**Last updated:** [April 28, 2022, 6:47am UTC](https://discourse.julialang.org/t/how-to-loop-over-the-key-value-pairs-of-a-namedtuple/5470 "2022-04-28T06:47:40Z")

</div>

I tried the following without success: using NamedTuples nt = @NT(a=1, b=1.0) for (k,v) in nt println(k, " =\> ", v) end

---

## [ReinterpretedArray Performance (even worse on 1.8)](https://discourse.julialang.org/t/reinterpretedarray-performance-even-worse-on-1-8/80102)

<div class="topic-metadata">

**Author:** [@cortner](https://discourse.julialang.org/u/cortner)\
**Replies:** 26\
**Last updated:** [April 28, 2022, 6:16am UTC](https://discourse.julialang.org/t/reinterpretedarray-performance-even-worse-on-1-8/80102 "2022-04-28T06:16:45Z")

</div>

I’d like to use reinterpreted arrays to write into and read from an array. Here is a little script that is a bit oversimplified but not too far from my real use-case. using BenchmarkTools function cheb!(A, x) A\[1\] =…

---

## [NaN errors in Flux](https://discourse.julialang.org/t/nan-errors-in-flux/80092)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 4\
**Last updated:** [April 27, 2022, 10:33pm UTC](https://discourse.julialang.org/t/nan-errors-in-flux/80092 "2022-04-27T22:33:04Z")

</div>

Hi all, I am trying to replicate a Likelihood Approximation Network (LAN) with Flux.jl. LANs are used to learn the likelihood function of intractable computational models. As a proof of concept, I am trying to apply th…

---

## [Append a single line to a csv file for a multiple of times using Julia](https://discourse.julialang.org/t/append-a-single-line-to-a-csv-file-for-a-multiple-of-times-using-julia/24200)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 8\
**Last updated:** [April 27, 2022, 9:02pm UTC](https://discourse.julialang.org/t/append-a-single-line-to-a-csv-file-for-a-multiple-of-times-using-julia/24200 "2022-04-27T21:02:59Z")

</div>

Hi, my task is to append a single line to a given csv file for a couple of times using Julia. There might be more than one ways to do it. I was thinking to use the DataFrames module and the CSV module to accomplish this.…

---

## [WGLMakie, JSServer Button, update camera](https://discourse.julialang.org/t/wglmakie-jsserver-button-update-camera/80169)

<div class="topic-metadata">

**Author:** [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Replies:** 0\
**Last updated:** [April 27, 2022, 8:42pm UTC](https://discourse.julialang.org/t/wglmakie-jsserver-button-update-camera/80169 "2022-04-27T20:42:43Z")

</div>

The following updates correctly the colormap, however ignores all camera updates. Any hints on how to fix this? using WGLMakie, JSServe, Observables using JSServe: Button page = Page(offline=true, exportable=true); app…

---

## [How to interpret the methods for Union{}?](https://discourse.julialang.org/t/how-to-interpret-the-methods-for-union/80166)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 1\
**Last updated:** [April 27, 2022, 7:23pm UTC](https://discourse.julialang.org/t/how-to-interpret-the-methods-for-union/80166 "2022-04-27T19:23:44Z")

</div>

I find julia\> methods(Union{}) # 4 methods for callable object: \[1\] (::Type{T})(x::Number) where T\<:AbstractChar in Base at char.jl:48 \[2\] (::Type{T})(x::Rational{S}) where {S, T\<:AbstractFloat} in Base at rational.jl:1…

---

## [Slow multiplication of transpose of sparse matrix](https://discourse.julialang.org/t/slow-multiplication-of-transpose-of-sparse-matrix/80153)

<div class="topic-metadata">

**Author:** [@andresdrenik](https://discourse.julialang.org/u/andresdrenik)\
**Replies:** 5\
**Last updated:** [April 27, 2022, 7:05pm UTC](https://discourse.julialang.org/t/slow-multiplication-of-transpose-of-sparse-matrix/80153 "2022-04-27T19:05:49Z")

</div>

I’m having speed issues multiplying the transpose of a sparse matrix with a column vector. In my code the matrix A is 501×501 SparseMatrixCSC{Float64, Integer} with 1501 stored entries: ⠻⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸ ⠀⠈⠻⣦⡀⠀⠀⠀⠀…

---

## [Best Practices for reporting bugs or suggesting improvements to Julia Docs](https://discourse.julialang.org/t/best-practices-for-reporting-bugs-or-suggesting-improvements-to-julia-docs/80157)

<div class="topic-metadata">

**Author:** [@chadagreene](https://discourse.julialang.org/u/chadagreene)\
**Replies:** 1\
**Last updated:** [April 27, 2022, 5:10pm UTC](https://discourse.julialang.org/t/best-practices-for-reporting-bugs-or-suggesting-improvements-to-julia-docs/80157 "2022-04-27T17:10:00Z")

</div>

What’s the best way to Report possible typos or other technical errors in Julia Documentation, or Discuss potential improvements to the documentation, beyond minor typos? For example, in the documentation for the sin …

---

## [\`Vector{Float64} \<: Vector{Any}\` = false, why?](https://discourse.julialang.org/t/vector-float64-vector-any-false-why/80103)

<div class="topic-metadata">

**Author:** [@Brad\_Carman](https://discourse.julialang.org/u/Brad_Carman)\
**Replies:** 12\
**Last updated:** [April 27, 2022, 5:00pm UTC](https://discourse.julialang.org/t/vector-float64-vector-any-false-why/80103 "2022-04-27T17:00:58Z")

</div>

My apologies if this has been covered previously. I just got burned by this, I was assuming I could use ::Vector{Any} to cover an input of Vector{Float64}, Vector{Int}, etc. But it turns out that Julia doesn’t believe V…

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

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