# General Usage

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

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

**Page:** 588

---

## [Advance model building, why Split returns a Tuple?\[Pedagogical question\]](https://discourse.julialang.org/t/advance-model-building-why-split-returns-a-tuple-pedagogical-question/62882)

<div class="topic-metadata">

**Author:** [@deveshjawla](https://discourse.julialang.org/u/deveshjawla)\
**Replies:** 0\
**Last updated:** [June 14, 2021, 11:53am UTC](https://discourse.julialang.org/t/advance-model-building-why-split-returns-a-tuple-pedagogical-question/62882 "2021-06-14T11:53:53Z")

</div>

In the advanced model building @ https://fluxml.ai/Flux.jl/stable/models/advanced/#Multiple-outputs:-a-custom-Split-layer Is there any reason why a tuple is used in the code? see below for the exact line. (m::Split)(x…

---

## [Pattern to use additional variables in do block?](https://discourse.julialang.org/t/pattern-to-use-additional-variables-in-do-block/62871)

<div class="topic-metadata">

**Author:** [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)\
**Replies:** 2\
**Last updated:** [June 14, 2021, 11:52am UTC](https://discourse.julialang.org/t/pattern-to-use-additional-variables-in-do-block/62871 "2021-06-14T11:52:42Z")

</div>

I’m trying to write a small package to process files in an easy way. I often write very similar scripts that open files, read them record by record, process the record in some way (modify it or filter it out), close the …

---

## [How to implement multi-threading with external in-place mutable variables?](https://discourse.julialang.org/t/how-to-implement-multi-threading-with-external-in-place-mutable-variables/62610)

<div class="topic-metadata">

**Author:** [@mlanghinrichs](https://discourse.julialang.org/u/mlanghinrichs)\
**Replies:** 4\
**Last updated:** [June 14, 2021, 11:30am UTC](https://discourse.julialang.org/t/how-to-implement-multi-threading-with-external-in-place-mutable-variables/62610 "2021-06-14T11:30:00Z")

</div>

Hey, I’m wondering how to implement a method with multi-threading that also allows for mutating external variables in-place. The idea is that each thread/base requires their “own” external variable for data race free mu…

---

## [Multidimensional Interpolation with knots condition?](https://discourse.julialang.org/t/multidimensional-interpolation-with-knots-condition/62869)

<div class="topic-metadata">

**Author:** [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Replies:** 0\
**Last updated:** [June 14, 2021, 9:29am UTC](https://discourse.julialang.org/t/multidimensional-interpolation-with-knots-condition/62869 "2021-06-14T09:29:51Z")

</div>

Hi Everyone! I am trying to make up an interpolated multidimansional function with 5 dimensions and 1 variable. In this case: X1 X2 X3 X4 X5 Density X1=Tempertaure X2=Preassure X3 to X5: % of composition of 3 elements…

---

## [An undefined variable error during parallel computing](https://discourse.julialang.org/t/an-undefined-variable-error-during-parallel-computing/62482)

<div class="topic-metadata">

**Author:** [@marouane](https://discourse.julialang.org/u/marouane)\
**Replies:** 6\
**Last updated:** [June 14, 2021, 7:49am UTC](https://discourse.julialang.org/t/an-undefined-variable-error-during-parallel-computing/62482 "2021-06-14T07:49:36Z")

</div>

an unexpected error happened while trying to use Distributed for the parallel computing of a module, my apologies if this questions is going to be a little bit long: i already set up the cores and everything for distrib…

---

## [Asynchronous requests HTTP.jl + LibPQ](https://discourse.julialang.org/t/asynchronous-requests-http-jl-libpq/62736)

<div class="topic-metadata">

**Author:** [@Michal](https://discourse.julialang.org/u/Michal)\
**Replies:** 2\
**Last updated:** [June 14, 2021, 5:10am UTC](https://discourse.julialang.org/t/asynchronous-requests-http-jl-libpq/62736 "2021-06-14T05:10:30Z")

</div>

1. HTTP.jl I’m looking for correct solution for asynchronous handling requests by HTTP.jl. Please, do you know how should I implement this behavior? 1 thread request handling: function requestHandler(req::HTTP.Request…

---

## [How to use differently sized static arrays per project](https://discourse.julialang.org/t/how-to-use-differently-sized-static-arrays-per-project/62834)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 11\
**Last updated:** [June 13, 2021, 10:56pm UTC](https://discourse.julialang.org/t/how-to-use-differently-sized-static-arrays-per-project/62834 "2021-06-13T22:56:09Z")

</div>

Hello, I have a module called Utils (see KiteViewer/Utils.jl at sim · ufechner7/KiteViewer · GitHub). It provides a function se() that returns a struct of simulation settings. These settings are loaded from a YAML fil…

---

## [What's the difference between these two types with implicit and explicit parameters?](https://discourse.julialang.org/t/whats-the-difference-between-these-two-types-with-implicit-and-explicit-parameters/62849)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 3\
**Last updated:** [June 13, 2021, 9:31pm UTC](https://discourse.julialang.org/t/whats-the-difference-between-these-two-types-with-implicit-and-explicit-parameters/62849 "2021-06-13T21:31:11Z")

</div>

julia\> T1 = Vector{S} where {T\<:Integer, S\<:AbstractUnitRange{T}} Vector{S} where {T\<:Integer, S\<:AbstractUnitRange{T}} (alias for Array{S, 1} where {T\<:Integer, S\<:AbstractUnitRange{T}}) julia\> T2 = Vector{S} where {S\<:…

---

## [ERROR: LoadError: StackOverflowError:](https://discourse.julialang.org/t/error-loaderror-stackoverflowerror/62846)

<div class="topic-metadata">

**Author:** [@Akshay\_gupta](https://discourse.julialang.org/u/Akshay_gupta)\
**Replies:** 2\
**Last updated:** [June 13, 2021, 9:11pm UTC](https://discourse.julialang.org/t/error-loaderror-stackoverflowerror/62846 "2021-06-13T21:11:37Z")

</div>

I am trying to implement this algorithm of python for solving sudoku in Julia, but I am getting ERROR: LoadError: StackOverflowError: Stacktrace: \[1\] eliminate(values::Dict{String, String}, s::String, d::Char) …

---

## [Make this Tuple code faster](https://discourse.julialang.org/t/make-this-tuple-code-faster/62824)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 11\
**Last updated:** [June 13, 2021, 6:37pm UTC](https://discourse.julialang.org/t/make-this-tuple-code-faster/62824 "2021-06-13T18:37:51Z")

</div>

I have a Tuple and want to replace its starting segment: function switch\_front(new\_front, t) n = length(t) k = length(new\_front) @assert k \<= n (new\_front..., t\[k+1:n\]...) end using Test @test switch\_fr…

---

## [Shared Variables In Nested Macros](https://discourse.julialang.org/t/shared-variables-in-nested-macros/62821)

<div class="topic-metadata">

**Author:** [@Acmion](https://discourse.julialang.org/u/Acmion)\
**Replies:** 2\
**Last updated:** [June 13, 2021, 4:31pm UTC](https://discourse.julialang.org/t/shared-variables-in-nested-macros/62821 "2021-06-13T16:31:39Z")

</div>

I’d like to share variables between nested macros in a convenient manner, but this seems to be difficult. I will try to illustrate the situation with some code examples. To create custom properties to Julia types one ca…

---

## [Dot operator, 1. with array-indexing expression on the left-hand side and 2. with Matrix\*Vector-multiplication](https://discourse.julialang.org/t/dot-operator-1-with-array-indexing-expression-on-the-left-hand-side-and-2-with-matrix-vector-multiplication/62743)

<div class="topic-metadata">

**Author:** [@hardy](https://discourse.julialang.org/u/hardy)\
**Replies:** 18\
**Last updated:** [June 13, 2021, 3:52pm UTC](https://discourse.julialang.org/t/dot-operator-1-with-array-indexing-expression-on-the-left-hand-side-and-2-with-matrix-vector-multiplication/62743 "2021-06-13T15:52:56Z")

</div>

Hallo, I would like to understand how the dot operator works. There are two specific problems: at Performance Tips · The Julia Language (headline: Consider using views for slicing) I learned that “…on the left-ha…

---

## [Unicode error with Plots.jl and PGFPlotsX](https://discourse.julialang.org/t/unicode-error-with-plots-jl-and-pgfplotsx/53070)

<div class="topic-metadata">

**Author:** [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Replies:** 1\
**Last updated:** [June 13, 2021, 12:15pm UTC](https://discourse.julialang.org/t/unicode-error-with-plots-jl-and-pgfplotsx/53070 "2021-06-13T12:15:58Z")

</div>

Using Plots with PGFPlotsX backend I get strange substitutions for some characters in the tex file. For example, this code plot( title = "Interpolação polinomial" ) savefig("fig.tex") generates a file f…

---

## [Check recursive immutability](https://discourse.julialang.org/t/check-recursive-immutability/62815)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 8\
**Last updated:** [June 13, 2021, 9:52am UTC](https://discourse.julialang.org/t/check-recursive-immutability/62815 "2021-06-13T09:52:21Z")

</div>

struct Foo val::Vector{Int} end How can I check if a type is recursively immutable? I tried function recursively\_immutable(type) !type.mutable && all(recursively\_immutable(ft) for ft in fieldtypes(type)) end b…

---

## [Vector multiplication](https://discourse.julialang.org/t/vector-multiplication/62830)

<div class="topic-metadata">

**Author:** [@BYS](https://discourse.julialang.org/u/BYS)\
**Replies:** 0\
**Last updated:** [June 13, 2021, 9:25am UTC](https://discourse.julialang.org/t/vector-multiplication/62830 "2021-06-13T09:25:00Z")

</div>

Hi, everyone I find there is a little different between model2=Model() h\_set=Vector(1:10) h0=Vector(1.1:0.1:2) @variable(model2,h\[h\_set,1:20\]) @constraint(model2,ones(10)'\*(h0-h\[:,1\])==0) and model2=Model() h0=Vector…

---

## [Plots.jl - Controlling dash pattern with PGFPlotsx Backend](https://discourse.julialang.org/t/plots-jl-controlling-dash-pattern-with-pgfplotsx-backend/55332)

<div class="topic-metadata">

**Author:** [@Kevin\_Kleinbeck](https://discourse.julialang.org/u/Kevin_Kleinbeck)\
**Replies:** 0\
**Last updated:** [February 15, 2021, 4:21pm UTC](https://discourse.julialang.org/t/plots-jl-controlling-dash-pattern-with-pgfplotsx-backend/55332 "2021-02-15T16:21:36Z")

</div>

I encountered following problem. The default settings of pgfplots produce dashed lines which are indistinguishable from dotted lines at larger line widths. Consider the MWE using Plots pgfplotsx() plot(x -\> sin(x), line…

---

## [containers.Map(keyset, valueset) from Matlab to Julia](https://discourse.julialang.org/t/containers-map-keyset-valueset-from-matlab-to-julia/62768)

<div class="topic-metadata">

**Author:** [@GAiello](https://discourse.julialang.org/u/GAiello)\
**Replies:** 1\
**Last updated:** [June 13, 2021, 1:26am UTC](https://discourse.julialang.org/t/containers-map-keyset-valueset-from-matlab-to-julia/62768 "2021-06-13T01:26:18Z")

</div>

Hello Everybody, Is there in Julia something similar to Matlab’s command containers.Map(keyset, valueset)? Thank you very much

---

## [Cannot find overloaded method](https://discourse.julialang.org/t/cannot-find-overloaded-method/48633)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 28\
**Last updated:** [June 12, 2021, 9:43pm UTC](https://discourse.julialang.org/t/cannot-find-overloaded-method/48633 "2021-06-12T21:43:23Z")

</div>

At least for interactive usage it is often convenient to have a replace method for strings that can perform multiple replacements at once. So I try do define it, but julia (1.5) doesn’t find the new method even though it…

---

## [Tutorial on closures?](https://discourse.julialang.org/t/tutorial-on-closures/62749)

<div class="topic-metadata">

**Author:** [@Arrigo\_Benedetti](https://discourse.julialang.org/u/Arrigo_Benedetti)\
**Replies:** 5\
**Last updated:** [June 12, 2021, 9:07pm UTC](https://discourse.julialang.org/t/tutorial-on-closures/62749 "2021-06-12T21:07:59Z")

</div>

I want to learn more about closures and their use with Julia. Does anyone recommend any paper/tutorial/book/blog post clearly explaining closures and what are their use cases for Julia programming? Most of the material …

---

## [Testing nested parallelization with @distributed and @spawn/@threads](https://discourse.julialang.org/t/testing-nested-parallelization-with-distributed-and-spawn-threads/62803)

<div class="topic-metadata">

**Author:** [@swishmas](https://discourse.julialang.org/u/swishmas)\
**Replies:** 0\
**Last updated:** [June 12, 2021, 4:37pm UTC](https://discourse.julialang.org/t/testing-nested-parallelization-with-distributed-and-spawn-threads/62803 "2021-06-12T16:37:22Z")

</div>

I know this is a popular topic, but I wanted to check my understanding on nested parallelization with @distributed, @spawn, and @threads. Here’s a working example of a few different strategies using LinearAlgebra impor…

---

## [Musl needed for 1.6.1 is missing on ubuntu 20.04](https://discourse.julialang.org/t/musl-needed-for-1-6-1-is-missing-on-ubuntu-20-04/62798)

<div class="topic-metadata">

**Author:** [@dmg](https://discourse.julialang.org/u/dmg)\
**Replies:** 2\
**Last updated:** [June 12, 2021, 3:07pm UTC](https://discourse.julialang.org/t/musl-needed-for-1-6-1-is-missing-on-ubuntu-20-04/62798 "2021-06-12T15:07:19Z")

</div>

Hi all, I’ve been successfully running 1.5.3 for a while now, but a package I installed (Actors) said I needed 1.6 so I downloaded 1.6.1. It didn’t run on my Ubuntu 20.04 system and running ldd on the executable gave…

---

## [Replacing eval(Meta.parse(...)) with macro](https://discourse.julialang.org/t/replacing-eval-meta-parse-with-macro/62788)

<div class="topic-metadata">

**Author:** [@MartaVanin](https://discourse.julialang.org/u/MartaVanin)\
**Replies:** 4\
**Last updated:** [June 12, 2021, 1:31pm UTC](https://discourse.julialang.org/t/replacing-eval-meta-parse-with-macro/62788 "2021-06-12T13:31:41Z")

</div>

Hello, I want to push a number of anonymous functions to an array. Each function is largely the same but in some cases some addends are scalars instead of variables. Say that there are three different cases, like: case…

---

## [Is there a function to check if every package in my \[deps\] has a \[compat\] entry in Project.toml?](https://discourse.julialang.org/t/is-there-a-function-to-check-if-every-package-in-my-deps-has-a-compat-entry-in-project-toml/62708)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 7\
**Last updated:** [June 12, 2021, 9:58am UTC](https://discourse.julialang.org/t/is-there-a-function-to-check-if-every-package-in-my-deps-has-a-compat-entry-in-project-toml/62708 "2021-06-12T09:58:05Z")

</div>

Sometimes, before I publish a new version of the package I accidentally forget that I’ve added a package to the dependencies and forgot to add \[compat\] entries in Project.toml. I think I should add a git hook to remind …

---

## [Generic function to bind arguments somewhere?](https://discourse.julialang.org/t/generic-function-to-bind-arguments-somewhere/62787)

<div class="topic-metadata">

**Author:** [@oschulz](https://discourse.julialang.org/u/oschulz)\
**Replies:** 0\
**Last updated:** [June 12, 2021, 10:02am UTC](https://discourse.julialang.org/t/generic-function-to-bind-arguments-somewhere/62787 "2021-06-12T10:02:59Z")

</div>

Do we have a generic extension of Base.Fix1 and Base.Fix2 in a lightweight package somewhere? I mean some equivalent of function bind\_args(f, bound\_args...; bound\_kwargs...) (args...; kwargs...) -\> f(bound\_args...,…

---

## [Writing larger than expected binary files](https://discourse.julialang.org/t/writing-larger-than-expected-binary-files/62600)

<div class="topic-metadata">

**Author:** [@k945](https://discourse.julialang.org/u/k945)\
**Replies:** 1\
**Last updated:** [June 12, 2021, 3:23am UTC](https://discourse.julialang.org/t/writing-larger-than-expected-binary-files/62600 "2021-06-12T03:23:59Z")

</div>

When using FortranFiles, I was wondering why writing a new file, with the same data and structure as the original, produces a file whose size is significantly larger (~925MB) than the original (~25MB). Is there a compres…

---

## [Optimizing Code to Fit a Generalized Pareto Distribution to Data](https://discourse.julialang.org/t/optimizing-code-to-fit-a-generalized-pareto-distribution-to-data/62690)

<div class="topic-metadata">

**Author:** [@ParadaCarleton](https://discourse.julialang.org/u/ParadaCarleton)\
**Replies:** 17\
**Last updated:** [June 12, 2021, 12:45am UTC](https://discourse.julialang.org/t/optimizing-code-to-fit-a-generalized-pareto-distribution-to-data/62690 "2021-06-12T00:45:54Z")

</div>

I’m trying to optimize the following very performance-critical piece of code: using Memoization, Statistics, LinearAlgebra, Tullio, LoopVectorization """ gpdfit(sample::AbstractArray, wip::Bool = true, min\_grid\_pts…

---

## [Zygote Performance (Again...)](https://discourse.julialang.org/t/zygote-performance-again/62753)

<div class="topic-metadata">

**Author:** [@cortner](https://discourse.julialang.org/u/cortner)\
**Replies:** 17\
**Last updated:** [June 11, 2021, 10:46pm UTC](https://discourse.julialang.org/t/zygote-performance-again/62753 "2021-06-11T22:46:55Z")

</div>

On simple reduction tasks Zygote seems to perform exceptionally poorly, and I would be grateful to hear why and what alternative patterns I should use to avoid these problems? I’ve started implementing custom adjoints vi…

---

## [How to access docstrings without REPL](https://discourse.julialang.org/t/how-to-access-docstrings-without-repl/62422)

<div class="topic-metadata">

**Author:** [@reinermartin](https://discourse.julialang.org/u/reinermartin)\
**Replies:** 7\
**Last updated:** [June 11, 2021, 9:44pm UTC](https://discourse.julialang.org/t/how-to-access-docstrings-without-repl/62422 "2021-06-11T21:44:17Z")

</div>

The user guide describes clearly how to access the docstring of a function via the help mode of the REPL. But how can I access the docstring without the REPL (from a program)?

---

## [Question about allocations and generators](https://discourse.julialang.org/t/question-about-allocations-and-generators/62693)

<div class="topic-metadata">

**Author:** [@RomainPct](https://discourse.julialang.org/u/RomainPct)\
**Replies:** 2\
**Last updated:** [June 11, 2021, 7:51pm UTC](https://discourse.julialang.org/t/question-about-allocations-and-generators/62693 "2021-06-11T19:51:08Z")

</div>

Hello, this this question is out of curiosity, hoping to understand more about Julia. Those three functions allocate differently: g1(v::Vector{Int64}) = SVector{length(v), Int64}(v...) g2(v::Vector{Int64}, n) = SVector…

---

## [Reset REPL terminal mode to working/default settings](https://discourse.julialang.org/t/reset-repl-terminal-mode-to-working-default-settings/51892)

<div class="topic-metadata">

**Author:** [@devel-chm](https://discourse.julialang.org/u/devel-chm)\
**Replies:** 3\
**Last updated:** [June 11, 2021, 5:03pm UTC](https://discourse.julialang.org/t/reset-repl-terminal-mode-to-working-default-settings/51892 "2021-06-11T17:03:46Z")

</div>

If I start the julia REPL on win10 and then use shell mode to run a cygwin program (e.g. bash or whatever) when I exit the cygwin program the REPL model prompt is messed up. Is there a way to reset the REPL terminal (li…

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

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