# General Usage

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

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

**Page:** 632

---

## [MethodError no method matching and no hints either](https://discourse.julialang.org/t/methoderror-no-method-matching-and-no-hints-either/56772)

<div class="topic-metadata">

**Author:** [@Paht\_J](https://discourse.julialang.org/u/Paht_J)\
**Replies:** 8\
**Last updated:** [March 9, 2021, 8:28pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-and-no-hints-either/56772 "2021-03-09T20:28:17Z")

</div>

Usually when Julia gives me a hint as to what types I should use. But in this case, it isn’t giving me any useful hints. Plot3D.jl ## Code dealing with Blocks @with\_kw struct Block IMAX::Int64 …

---

## [The slowest zipper](https://discourse.julialang.org/t/the-slowest-zipper/56815)

<div class="topic-metadata">

**Author:** [@markmbaum](https://discourse.julialang.org/u/markmbaum)\
**Replies:** 5\
**Last updated:** [March 9, 2021, 5:33pm UTC](https://discourse.julialang.org/t/the-slowest-zipper/56815 "2021-03-09T17:33:21Z")

</div>

I have an array of 1000 points, an Array{Array{Float64,1}} with length 1000. To separate the points into vectors of coordinates for each dimension, my Python instinct is to unpack the zipped points. For example, in Julia…

---

## [How to force compile-time evaluation of literal calculations?](https://discourse.julialang.org/t/how-to-force-compile-time-evaluation-of-literal-calculations/56822)

<div class="topic-metadata">

**Author:** [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Replies:** 4\
**Last updated:** [March 9, 2021, 5:18pm UTC](https://discourse.julialang.org/t/how-to-force-compile-time-evaluation-of-literal-calculations/56822 "2021-03-09T17:18:16Z")

</div>

I often want to write large integer values such as 10^6 in performance critical functions. I would expect Julia to perform these calculations at compile-time when possible, but it doesn’t appear to do so: julia\> functi…

---

## [Dict key=\>value to array in comprehension](https://discourse.julialang.org/t/dict-key-value-to-array-in-comprehension/56818)

<div class="topic-metadata">

**Author:** [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Replies:** 3\
**Last updated:** [March 9, 2021, 4:52pm UTC](https://discourse.julialang.org/t/dict-key-value-to-array-in-comprehension/56818 "2021-03-09T16:52:16Z")

</div>

I’m trying to build a Cmd from the kwargs of a function. Basically, I want to turn eg foo("some\_option"; opt1 = "thing", opt2="other\_thing") into run(\`my\_cli some\_option --opt1 thing --opt2 other\_thing\`). Cmd() can take …

---

## [Are integers immutable and are they acceptable as keys in](https://discourse.julialang.org/t/are-integers-immutable-and-are-they-acceptable-as-keys-in/56816)

<div class="topic-metadata">

**Author:** [@anon60034542](https://discourse.julialang.org/u/anon60034542)\
**Replies:** 1\
**Last updated:** [March 9, 2021, 3:57pm UTC](https://discourse.julialang.org/t/are-integers-immutable-and-are-they-acceptable-as-keys-in/56816 "2021-03-09T15:57:28Z")

</div>

I was reading about Mutable Composite Types, and it says: In particular, this means that small enough immutable values like integers and floats are typically passed to functions in registers (or stack allocated). Are…

---

## [Interpolating an \`Expr\` containing \`SSAValue\`s/\`Slot\`s into another \`Expr\`](https://discourse.julialang.org/t/interpolating-an-expr-containing-ssavalue-s-slot-s-into-another-expr/56796)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [March 9, 2021, 2:59pm UTC](https://discourse.julialang.org/t/interpolating-an-expr-containing-ssavalue-s-slot-s-into-another-expr/56796 "2021-03-09T14:59:04Z")

</div>

Anyone know a way to interpolate an Expr containing SSAValues/Slots into another expression? Something like julia\> @eval Main ans = $(QuoteNode(code\_typed(cos, (Float64, ))\[1\]\[1\].code\[50\])) ERROR: syntax: SSAValue objec…

---

## [SVD gives different results from Python with MWE](https://discourse.julialang.org/t/svd-gives-different-results-from-python-with-mwe/56674)

<div class="topic-metadata">

**Author:** [@kadir-gunel](https://discourse.julialang.org/u/kadir-gunel)\
**Replies:** 15\
**Last updated:** [March 9, 2021, 2:32pm UTC](https://discourse.julialang.org/t/svd-gives-different-results-from-python-with-mwe/56674 "2021-03-09T14:32:53Z")

</div>

Hello, I have a python written code, and it uses svd from numpy. And I am trying to port the same code in Julia. The problem I am facing is that after some point, even though I read the same files for both programming …

---

## [How to resolve \`Any\`s in this function?](https://discourse.julialang.org/t/how-to-resolve-any-s-in-this-function/56717)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 16\
**Last updated:** [March 9, 2021, 12:44pm UTC](https://discourse.julialang.org/t/how-to-resolve-any-s-in-this-function/56717 "2021-03-09T12:44:07Z")

</div>

Consider this: using ComponentArrays, Parameters function test(g, a; data=data) @unpack P = data if g == 1 oc = (g, a) -\> P\[g, a\] elseif g == 2 oc = (g, a) -\> P\[g, a\] + 1 end return…

---

## [Macro: is it possible to receive an evaluated argument?](https://discourse.julialang.org/t/macro-is-it-possible-to-receive-an-evaluated-argument/56788)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 8\
**Last updated:** [March 9, 2021, 11:02am UTC](https://discourse.julialang.org/t/macro-is-it-possible-to-receive-an-evaluated-argument/56788 "2021-03-09T11:02:24Z")

</div>

I’d like to manipulate function arguments easily and I expect that macro can do this. However, I probably misunderstood the usage of macro. For example, the following is a brief (probably not runnable) code describing …

---

## [ReadOnlyMemoryError](https://discourse.julialang.org/t/readonlymemoryerror/8548)

<div class="topic-metadata">

**Author:** [@Stephen\_Vavasis](https://discourse.julialang.org/u/Stephen_Vavasis)\
**Replies:** 14\
**Last updated:** [March 9, 2021, 7:20am UTC](https://discourse.julialang.org/t/readonlymemoryerror/8548 "2021-03-09T07:20:27Z")

</div>

I have a lengthy code that recently has stopped working on my Linux machine (Julia 0.6.2) although it’s still fine on Windows. I don’t have a MWE; the site of the error moves with small changes to the code. Anyone hav…

---

## [Looking for a time-series jump test package](https://discourse.julialang.org/t/looking-for-a-time-series-jump-test-package/56773)

<div class="topic-metadata">

**Author:** [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Replies:** 4\
**Last updated:** [March 9, 2021, 7:40am UTC](https://discourse.julialang.org/t/looking-for-a-time-series-jump-test-package/56773 "2021-03-09T07:40:37Z")

</div>

Are there any Julia packages that can detect time-series jumps?

---

## [Macro: is it possible to receive a function and manipulate its arguments?](https://discourse.julialang.org/t/macro-is-it-possible-to-receive-a-function-and-manipulate-its-arguments/56781)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 2\
**Last updated:** [March 9, 2021, 3:56am UTC](https://discourse.julialang.org/t/macro-is-it-possible-to-receive-a-function-and-manipulate-its-arguments/56781 "2021-03-09T03:56:15Z")

</div>

Hi. I’m a newbie of Julia macro. I’d like to know whether it’s possible to get a function and manipulate its arguments by macro. For example, something like this. @mymacro func(a, b) # == func(a+b, a-b)

---

## [How can you guarantee that all the functions / branches / loops in your package has been tested?](https://discourse.julialang.org/t/how-can-you-guarantee-that-all-the-functions-branches-loops-in-your-package-has-been-tested/55835)

<div class="topic-metadata">

**Author:** [@Lian\_Yunlong](https://discourse.julialang.org/u/Lian_Yunlong)\
**Replies:** 11\
**Last updated:** [March 9, 2021, 3:17am UTC](https://discourse.julialang.org/t/how-can-you-guarantee-that-all-the-functions-branches-loops-in-your-package-has-been-tested/55835 "2021-03-09T03:17:34Z")

</div>

Is there any automated testing method for a rather complicated package? Probably a macro that injects some logging commands to each function / if-else branch / for-loop and produce a statistical analysis of the coverage …

---

## [General questions from Python user](https://discourse.julialang.org/t/general-questions-from-python-user/55475)

<div class="topic-metadata">

**Author:** [@lancejnelson](https://discourse.julialang.org/u/lancejnelson)\
**Replies:** 59\
**Last updated:** [March 8, 2021, 10:49pm UTC](https://discourse.julialang.org/t/general-questions-from-python-user/55475 "2021-03-08T22:49:39Z")

</div>

Hi all, I heard from a friend that this is a great place to have conversations about Julia. I’ve been using Python for years but am intrigued by Julia. Big picture question: Will I have to try really hard to get Jul…

---

## [Progressbar for multiple workers -- connecting workers to RemoteChannel](https://discourse.julialang.org/t/progressbar-for-multiple-workers-connecting-workers-to-remotechannel/56683)

<div class="topic-metadata">

**Author:** [@jlbosse](https://discourse.julialang.org/u/jlbosse)\
**Replies:** 6\
**Last updated:** [March 8, 2021, 9:56pm UTC](https://discourse.julialang.org/t/progressbar-for-multiple-workers-connecting-workers-to-remotechannel/56683 "2021-03-08T21:56:38Z")

</div>

I am trying to expand the example given on the ProgressMeter.jl documentation to get a progress bar for a few slow processes that run in parallel. Since there are only few processes, but each of them take a long time I w…

---

## [Will the new github security policy affect the way we use/develop Julia packages?](https://discourse.julialang.org/t/will-the-new-github-security-policy-affect-the-way-we-use-develop-julia-packages/56677)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 3\
**Last updated:** [March 8, 2021, 8:28pm UTC](https://discourse.julialang.org/t/will-the-new-github-security-policy-affect-the-way-we-use-develop-julia-packages/56677 "2021-03-08T20:28:31Z")

</div>

I wonder if the new GitHub policy that from 13 August 2021 will disable simple password-based git commands workflow will affect the way we use or develop Julia packages.

---

## [Julia on free tier cloud instances](https://discourse.julialang.org/t/julia-on-free-tier-cloud-instances/56692)

<div class="topic-metadata">

**Author:** [@sschmidhuber](https://discourse.julialang.org/u/sschmidhuber)\
**Replies:** 4\
**Last updated:** [March 8, 2021, 7:45pm UTC](https://discourse.julialang.org/t/julia-on-free-tier-cloud-instances/56692 "2021-03-08T19:45:30Z")

</div>

Hello, I would like to run my little julia application on a free cloud machine. Currently I’m using a AWS EC2 t2.micro machine. Unfortunately the micro instance (1GB memory, 1vCPU) fails on precompilation of DataFrames. …

---

## [Subtyping Dict](https://discourse.julialang.org/t/subtyping-dict/56720)

<div class="topic-metadata">

**Author:** [@imLew](https://discourse.julialang.org/u/imLew)\
**Replies:** 8\
**Last updated:** [March 8, 2021, 6:44pm UTC](https://discourse.julialang.org/t/subtyping-dict/56720 "2021-03-08T18:44:25Z")

</div>

I’m using Dicts to store the parameters store the parameters of a problem to be solved by an algorithm. There are different types of problems and I would like to use multiple dispatch to organize the code for running the…

---

## [ChainRulesCore.rrule for custom struct: does the pullback need to support Composite explicitly?](https://discourse.julialang.org/t/chainrulescore-rrule-for-custom-struct-does-the-pullback-need-to-support-composite-explicitly/56734)

<div class="topic-metadata">

**Author:** [@yha](https://discourse.julialang.org/u/yha)\
**Replies:** 5\
**Last updated:** [March 8, 2021, 2:53pm UTC](https://discourse.julialang.org/t/chainrulescore-rrule-for-custom-struct-does-the-pullback-need-to-support-composite-explicitly/56734 "2021-03-08T14:53:15Z")

</div>

I’m trying to differentiate code involving GeometryBasics.Point construction (always with two arguments). This seems to allow Zygote to compute the gradient correctly: function ChainRulesCore.rrule(::Type{Point}, x::Nu…

---

## [How to print a tree "vertically" defined by \`AbstractTrees.jl\`](https://discourse.julialang.org/t/how-to-print-a-tree-vertically-defined-by-abstracttrees-jl/56729)

<div class="topic-metadata">

**Author:** [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Replies:** 2\
**Last updated:** [March 8, 2021, 1:57pm UTC](https://discourse.julialang.org/t/how-to-print-a-tree-vertically-defined-by-abstracttrees-jl/56729 "2021-03-08T13:57:53Z")

</div>

See the following example. julia\> using AbstractTrees julia\> function AbstractTrees.children(i::Integer) if i \<= 3 return i + 1, i + 2 end return () end julia\> pr…

---

## [If I have a an object of type \`Array{Float32, 2}\`, using \`eltype\` gives me \`Float3](https://discourse.julialang.org/t/if-i-have-a-an-object-of-type-array-float32-2-using-eltype-gives-me-float3/56733)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [March 8, 2021, 1:45pm UTC](https://discourse.julialang.org/t/if-i-have-a-an-object-of-type-array-float32-2-using-eltype-gives-me-float3/56733 "2021-03-08T13:45:03Z")

</div>

If I have a an object of type Array{Float32, 2}, using eltype gives me Float32, what gives me Array ? Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropri…

---

## [Checking if function input is DataFrame](https://discourse.julialang.org/t/checking-if-function-input-is-dataframe/56707)

<div class="topic-metadata">

**Author:** [@jo-fleck](https://discourse.julialang.org/u/jo-fleck)\
**Replies:** 5\
**Last updated:** [March 8, 2021, 12:44pm UTC](https://discourse.julialang.org/t/checking-if-function-input-is-dataframe/56707 "2021-03-08T12:44:05Z")

</div>

I wrote a function which inspects a data frame and, if its content meets certain requirements, sends it to a server. To make sure (new) users can easily understand which aspect of the content needs to be changed in case …

---

## [Modifiying Julia tuple, Dict and object from C](https://discourse.julialang.org/t/modifiying-julia-tuple-dict-and-object-from-c/56469)

<div class="topic-metadata">

**Author:** [@Clonkk](https://discourse.julialang.org/u/Clonkk)\
**Replies:** 9\
**Last updated:** [March 8, 2021, 8:47am UTC](https://discourse.julialang.org/t/modifiying-julia-tuple-dict-and-object-from-c/56469 "2021-03-08T08:47:43Z")

</div>

Hello, I haven’t seen anything in the documentation so I’m asking here; is there a way to manipulate tuple, Dict and object from C ? I create the Julia type in C using jl\_eval function - I haven’t found another way to …

---

## [Pre-allocated, thread-save buffer arrays](https://discourse.julialang.org/t/pre-allocated-thread-save-buffer-arrays/56715)

<div class="topic-metadata">

**Author:** [@Jae-Mo\_Lihm](https://discourse.julialang.org/u/Jae-Mo_Lihm)\
**Replies:** 0\
**Last updated:** [March 8, 2021, 6:52am UTC](https://discourse.julialang.org/t/pre-allocated-thread-save-buffer-arrays/56715 "2021-03-08T06:52:48Z")

</div>

In my program, I have a loop where I need a buffer array. The required size of the buffer changes only a few times during the run. Also, I am using multithreading. So, the buffer should be thread-safe. The following scr…

---

## [\<C-W\> deletes all texts up to the beginning, not a word, in REPL](https://discourse.julialang.org/t/c-w-deletes-all-texts-up-to-the-beginning-not-a-word-in-repl/56662)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 13\
**Last updated:** [March 8, 2021, 1:14am UTC](https://discourse.julialang.org/t/c-w-deletes-all-texts-up-to-the-beginning-not-a-word-in-repl/56662 "2021-03-08T01:14:17Z")

</div>

I think that \<C-W\> in JuliaREPL should remove text a word at once, not all texts up to the beginning. Is there any way to configure it as I want? Note: I’m using OhMyREPL. Julia Version 1.5.3 Commit 788b2c77c1 (2020-1…

---

## [Lingering Julia processes?](https://discourse.julialang.org/t/lingering-julia-processes/56699)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 1\
**Last updated:** [March 7, 2021, 11:00pm UTC](https://discourse.julialang.org/t/lingering-julia-processes/56699 "2021-03-07T23:00:10Z")

</div>

I have noticed that after closing VSCode, there remain about 3 or 4 Julia processes in the background. That is not because of indexing packages, because VSCode has already finished indexing, and there is no CPU usage by …

---

## [Citations in Weave](https://discourse.julialang.org/t/citations-in-weave/36918)

<div class="topic-metadata">

**Author:** [@andrewellis](https://discourse.julialang.org/u/andrewellis)\
**Replies:** 1\
**Last updated:** [March 7, 2021, 10:37pm UTC](https://discourse.julialang.org/t/citations-in-weave/36918 "2021-03-07T22:37:57Z")

</div>

Has anyone figured out how to include citations in Julia markdown with Weave.jl, either using pandoc’s markdown citation syntax, or LaTeX? I have tried to generate a markdown file using the pandoc doctype, and then run …

---

## [Hi all. I have a function in which I create an array but the type of the array is](https://discourse.julialang.org/t/hi-all-i-have-a-function-in-which-i-create-an-array-but-the-type-of-the-array-is/56665)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [March 7, 2021, 8:44pm UTC](https://discourse.julialang.org/t/hi-all-i-have-a-function-in-which-i-create-an-array-but-the-type-of-the-array-is/56665 "2021-03-07T20:44:10Z")

</div>

Hi all. I have a function in which I create an array but the type of the array is selected by the user meaning that it is passed as an argument something like: function f(T) arr = Matrix{T}(undef,3,3) return arr…

---

## [I have a function where I would like to move something from runtime to compile-tim](https://discourse.julialang.org/t/i-have-a-function-where-i-would-like-to-move-something-from-runtime-to-compile-tim/56681)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [March 7, 2021, 7:13pm UTC](https://discourse.julialang.org/t/i-have-a-function-where-i-would-like-to-move-something-from-runtime-to-compile-tim/56681 "2021-03-07T19:13:48Z")

</div>

I have a function where I would like to move something from runtime to compile-time. It looks similar to this function foo(x::Int, y::Val{Z}) where Z table = calc\_table(Z) bar(table, x) end I would like to move…

---

## [Text substitution (like sed) with Julia](https://discourse.julialang.org/t/text-substitution-like-sed-with-julia/56684)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 2\
**Last updated:** [March 7, 2021, 5:15pm UTC](https://discourse.julialang.org/t/text-substitution-like-sed-with-julia/56684 "2021-03-07T17:15:46Z")

</div>

If I want to replace all occurrences of “apple” by “orange” in a file, I can use the Unix shell command sed -i 's/apple/orange/g' filename.txt What would be an equivalent Julia code?

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

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