# General Usage

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

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

**Page:** 650

---

## [Writing a fast nlp tokenizer in Julia](https://discourse.julialang.org/t/writing-a-fast-nlp-tokenizer-in-julia/54176)

<div class="topic-metadata">

**Author:** [@merckxiaan](https://discourse.julialang.org/u/merckxiaan)\
**Replies:** 12\
**Last updated:** [February 2, 2021, 4:23pm UTC](https://discourse.julialang.org/t/writing-a-fast-nlp-tokenizer-in-julia/54176 "2021-02-02T16:23:46Z")

</div>

Hello everyone, As a learning exercise, I’m interested in writing a byte-pair-encoding (BPE) tokenizer in Julia. The meat of this tokenizer would be to find the most occuring pairs of tokens (initially these are just t…

---

## [Assignment vs mutation with bang! functions](https://discourse.julialang.org/t/assignment-vs-mutation-with-bang-functions/54466)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 2\
**Last updated:** [February 2, 2021, 4:14pm UTC](https://discourse.julialang.org/t/assignment-vs-mutation-with-bang-functions/54466 "2021-02-02T16:14:34Z")

</div>

Hi, a question on mutating functions. If I have a function sum!(A::Matrix, B::Matrix) that adds A to B in place, due to Julia’s way of handling arrays it won’t actually overwrite B unless I call it in the following way:…

---

## [Question: Is there a function to flatten a nested dictionary?](https://discourse.julialang.org/t/question-is-there-a-function-to-flatten-a-nested-dictionary/54462)

<div class="topic-metadata">

**Author:** [@florian](https://discourse.julialang.org/u/florian)\
**Replies:** 4\
**Last updated:** [February 2, 2021, 3:08pm UTC](https://discourse.julialang.org/t/question-is-there-a-function-to-flatten-a-nested-dictionary/54462 "2021-02-02T15:08:43Z")

</div>

Hi everyone, I’m facing the following problem: Suppose I have a nested dictionary like data = Dict( "id" =\> 42, "name" =\> Dict("first" =\> "John", "last" =\> "Doe", "nick" =\> nothing)) which I want to flatten i…

---

## [Julia package documentation “Load key: invalid format”](https://discourse.julialang.org/t/julia-package-documentation-load-key-invalid-format/54461)

<div class="topic-metadata">

**Author:** [@wangjie212](https://discourse.julialang.org/u/wangjie212)\
**Replies:** 0\
**Last updated:** [February 2, 2021, 2:08pm UTC](https://discourse.julialang.org/t/julia-package-documentation-load-key-invalid-format/54461 "2021-02-02T14:08:34Z")

</div>

I followed the hosting documentation (Documenter.jl) to deploy the documentation for the TSSOS Julia package. But I got the following error in the workflow (GitHub Actions): Failed to add the RSA host key for IP addres…

---

## [How to import to a Matrix data defined in the code script](https://discourse.julialang.org/t/how-to-import-to-a-matrix-data-defined-in-the-code-script/54452)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 2\
**Last updated:** [February 2, 2021, 12:21pm UTC](https://discourse.julialang.org/t/how-to-import-to-a-matrix-data-defined-in-the-code-script/54452 "2021-02-02T12:21:07Z")

</div>

For a DataFrame I can do: coeff = CSV.read(IOBuffer(""" -400 -100 1 0 0 0 0 -300 0 1 0 0 1 0 0 0 -1 0 0 1 0 0 0 -1 0.8 0.4 0 0…

---

## [Area under the solution curve](https://discourse.julialang.org/t/area-under-the-solution-curve/54442)

<div class="topic-metadata">

**Author:** [@vaglino](https://discourse.julialang.org/u/vaglino)\
**Replies:** 1\
**Last updated:** [February 2, 2021, 9:27am UTC](https://discourse.julialang.org/t/area-under-the-solution-curve/54442 "2021-02-02T09:27:02Z")

</div>

I am trying to calculate the integral of the solution of a differential equation and find the area under the curve. So far I numerically integrate the solution with a certain dt (see following MWE), but I was wondering …

---

## [MCMC for a customized distribution](https://discourse.julialang.org/t/mcmc-for-a-customized-distribution/54444)

<div class="topic-metadata">

**Author:** [@marouane](https://discourse.julialang.org/u/marouane)\
**Replies:** 3\
**Last updated:** [February 2, 2021, 10:03am UTC](https://discourse.julialang.org/t/mcmc-for-a-customized-distribution/54444 "2021-02-02T10:03:42Z")

</div>

Is there any good package for discret sampling and supports a customized distribution?

---

## [Error while Sampling in Turing.jl](https://discourse.julialang.org/t/error-while-sampling-in-turing-jl/54441)

<div class="topic-metadata">

**Author:** [@Sourav](https://discourse.julialang.org/u/Sourav)\
**Replies:** 0\
**Last updated:** [February 2, 2021, 8:30am UTC](https://discourse.julialang.org/t/error-while-sampling-in-turing-jl/54441 "2021-02-02T08:30:46Z")

</div>

When I try to run the code given in the turing examples, using Turing using StatsPlots # Define a simple Normal model with unknown mean and variance. @model function gdemo(x, y) s ~ InverseGamma(2, 3) m ~ Normal(0,…

---

## ["Dequeues" vs "deques"](https://discourse.julialang.org/t/dequeues-vs-deques/54428)

<div class="topic-metadata">

**Author:** [@yesenadam](https://discourse.julialang.org/u/yesenadam)\
**Replies:** 2\
**Last updated:** [February 2, 2021, 7:30am UTC](https://discourse.julialang.org/t/dequeues-vs-deques/54428 "2021-02-02T07:30:00Z")

</div>

Am pretty new to Julia, I guess this has been discussed before. Anyway… In the Julia documentation there’s a heading Dequeues. I gather this is a variant spelling of Deques, both pronounced decks. Isn’t that needlessly …

---

## [JuliaInXL in Excel](https://discourse.julialang.org/t/juliainxl-in-excel/36196)

<div class="topic-metadata">

**Author:** [@Maicol\_Hair\_Mendo\_Co](https://discourse.julialang.org/u/Maicol_Hair_Mendo_Co)\
**Replies:** 6\
**Last updated:** [February 2, 2021, 4:16am UTC](https://discourse.julialang.org/t/juliainxl-in-excel/36196 "2021-02-02T04:16:00Z")

</div>

I have JuliaPro and I just installed the JuliaInXL package and before I got this: \*\* incremental compilation may be broken for this module \*\*. Then I stop outputting that and when I want to use the package I can’t see th…

---

## [Pkg: Unsatisfiable requirements detected](https://discourse.julialang.org/t/pkg-unsatisfiable-requirements-detected/22269)

<div class="topic-metadata">

**Author:** [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Replies:** 10\
**Last updated:** [February 2, 2021, 1:30am UTC](https://discourse.julialang.org/t/pkg-unsatisfiable-requirements-detected/22269 "2021-02-02T01:30:51Z")

</div>

I have this problem when trying to install AutoGrad.jl (1.1) pkg\>add AutoGrad ERROR: Unsatisfiable requirements detected for package SIUnits \[b9d75638\]: SIUnits \[b9d75638\] log: ├─possible versions are: \[0.0.1-0.0.6, 0…

---

## [Hi! Suppose I want to code a function that returns a \`SVector\` but each component](https://discourse.julialang.org/t/hi-suppose-i-want-to-code-a-function-that-returns-a-svector-but-each-component/54372)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 9\
**Last updated:** [February 2, 2021, 12:14am UTC](https://discourse.julialang.org/t/hi-suppose-i-want-to-code-a-function-that-returns-a-svector-but-each-component/54372 "2021-02-02T00:14:23Z")

</div>

Hi! Suppose I want to code a function that returns a SVector but each component is computed inside the function without knowing the size. Should I create a MVector and then cast that to a SVector? This is what I am think…

---

## [When (likely) Julia 1.6 will be released?](https://discourse.julialang.org/t/when-likely-julia-1-6-will-be-released/51605)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 18\
**Last updated:** [February 1, 2021, 7:41pm UTC](https://discourse.julialang.org/t/when-likely-julia-1-6-will-be-released/51605 "2021-02-01T19:41:39Z")

</div>

I have a colleague that asked me help to install Julia, and I wanted to know when Julia 1.6 is likely to be released (I am afraid he get scared with the infamous time-to-first-plot issue). I understand that the correct …

---

## [Gnuplot.jl: errors and correlation matrix from fit?](https://discourse.julialang.org/t/gnuplot-jl-errors-and-correlation-matrix-from-fit/54411)

<div class="topic-metadata">

**Author:** [@Vasily\_Pisarev](https://discourse.julialang.org/u/Vasily_Pisarev)\
**Replies:** 0\
**Last updated:** [February 1, 2021, 7:26pm UTC](https://discourse.julialang.org/t/gnuplot-jl-errors-and-correlation-matrix-from-fit/54411 "2021-02-01T19:26:22Z")

</div>

The Gnuplot.jl manual nicely shows how to use curve-fitting feature of gnulot from Julia and get the converged fit parameters. Is it possible to get the estimated uncertainties of the parameters and the correlation matri…

---

## [Scoping issues with Macro in Module](https://discourse.julialang.org/t/scoping-issues-with-macro-in-module/54383)

<div class="topic-metadata">

**Author:** [@mrVeng](https://discourse.julialang.org/u/mrVeng)\
**Replies:** 3\
**Last updated:** [February 1, 2021, 5:43pm UTC](https://discourse.julialang.org/t/scoping-issues-with-macro-in-module/54383 "2021-02-01T17:43:55Z")

</div>

Hi everyone, I need to create a mutable struct where I do not know the number of fields a priori. I could alternatively just use a NamedTuple for this, but in this case the struct is preferable to me. I can do this wond…

---

## [Flux.@nograd equivalence in forwarddiff.jl?](https://discourse.julialang.org/t/flux-nograd-equivalence-in-forwarddiff-jl/54395)

<div class="topic-metadata">

**Author:** [@DeepQ](https://discourse.julialang.org/u/DeepQ)\
**Replies:** 1\
**Last updated:** [February 1, 2021, 5:25pm UTC](https://discourse.julialang.org/t/flux-nograd-equivalence-in-forwarddiff-jl/54395 "2021-02-01T17:25:36Z")

</div>

What is the equivalence of Flux.@nograd macro in forwarddiff.jl package?

---

## [Is there a package for loading SVG files?](https://discourse.julialang.org/t/is-there-a-package-for-loading-svg-files/54376)

<div class="topic-metadata">

**Author:** [@mihalybaci](https://discourse.julialang.org/u/mihalybaci)\
**Replies:** 2\
**Last updated:** [February 1, 2021, 5:07pm UTC](https://discourse.julialang.org/t/is-there-a-package-for-loading-svg-files/54376 "2021-02-01T17:07:44Z")

</div>

Is there is a package for loading SVG files? I have checked the usual suspects (Images, ImageMagick, FileIO, and ImageIO) and none of them provide loading of SVG, just writing apparently.

---

## [How to include resource files in a package](https://discourse.julialang.org/t/how-to-include-resource-files-in-a-package/54391)

<div class="topic-metadata">

**Author:** [@ollecram](https://discourse.julialang.org/u/ollecram)\
**Replies:** 2\
**Last updated:** [February 1, 2021, 4:51pm UTC](https://discourse.julialang.org/t/how-to-include-resource-files-in-a-package/54391 "2021-02-01T16:51:01Z")

</div>

I am writing a simple CAD-like system in Julia where, among other things, I have functions that produce LaTeX commands for drawing 2D shapes. These are just fragments that need to be include-d in a main.tex LaTeX file wi…

---

## [Implementation of an implace Hessian of a vector-valued function?](https://discourse.julialang.org/t/implementation-of-an-implace-hessian-of-a-vector-valued-function/33720)

<div class="topic-metadata">

**Author:** [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Replies:** 5\
**Last updated:** [February 1, 2021, 4:45pm UTC](https://discourse.julialang.org/t/implementation-of-an-implace-hessian-of-a-vector-valued-function/33720 "2021-02-01T16:45:05Z")

</div>

HI, i’m looking to implement an implace hessian of a vector-valued function, for example: f(x) = \[x\[1\],x\[2\],sin(x\[1\]),sum(x)\] The ForwardDiff Documentation gives an out of place example (slightly wrong, as size(f(x)) …

---

## [Is there a way to tell if a function was \`@inline\`’d?](https://discourse.julialang.org/t/is-there-a-way-to-tell-if-a-function-was-inline-d/54392)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 1, 2021, 4:23pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-tell-if-a-function-was-inline-d/54392 "2021-02-01T16:23:44Z")

</div>

Is there a way to tell if a function was @inline’d? Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster he…

---

## [StructArrays creating a lot of allocations compared to arrays](https://discourse.julialang.org/t/structarrays-creating-a-lot-of-allocations-compared-to-arrays/54377)

<div class="topic-metadata">

**Author:** [@MrRobot](https://discourse.julialang.org/u/MrRobot)\
**Replies:** 2\
**Last updated:** [February 1, 2021, 3:28pm UTC](https://discourse.julialang.org/t/structarrays-creating-a-lot-of-allocations-compared-to-arrays/54377 "2021-02-01T15:28:21Z")

</div>

I am converting a molecular dynamics code from passing arrays, to instead holding information in StructArray’s. Unfortunately, the code is now 20 times slower. Below I have two identical MWE, one doing the force calcula…

---

## [Hello, could I get help with why Julia isn't able to find a file?\`\`\`pk\_df = DataF](https://discourse.julialang.org/t/hello-could-i-get-help-with-why-julia-isnt-able-to-find-a-file-pk-df-dataf/54382)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 1, 2021, 3:02pm UTC](https://discourse.julialang.org/t/hello-could-i-get-help-with-why-julia-isnt-able-to-find-a-file-pk-df-dataf/54382 "2021-02-01T15:02:55Z")

</div>

Hello, could I get help with why Julia isn’t able to find a file? pk\_df = DataFrame(CSV.File( "./Data/data\_all\_mice\_all\_humans\_corrected\_3SA\_DEL.csv", missingstrings = \["", "NA"\])) \`ArgumentError: “./Data/data\_a…

---

## [Julia is busy on one thread all the time](https://discourse.julialang.org/t/julia-is-busy-on-one-thread-all-the-time/53428)

<div class="topic-metadata">

**Author:** [@Xijiang\_Yu](https://discourse.julialang.org/u/Xijiang_Yu)\
**Replies:** 4\
**Last updated:** [February 1, 2021, 11:12am UTC](https://discourse.julialang.org/t/julia-is-busy-on-one-thread-all-the-time/53428 "2021-02-01T11:12:25Z")

</div>

Julia 1.7.0-DEV.320 There is always one thread almost always 100% occupied on my machine. I have only a REPL running, and I called no function.

---

## [Is it worth it to check if a collection is empty before iterating?](https://discourse.julialang.org/t/is-it-worth-it-to-check-if-a-collection-is-empty-before-iterating/54360)

<div class="topic-metadata">

**Author:** [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Replies:** 5\
**Last updated:** [February 1, 2021, 9:23am UTC](https://discourse.julialang.org/t/is-it-worth-it-to-check-if-a-collection-is-empty-before-iterating/54360 "2021-02-01T09:23:22Z")

</div>

Is it worth checking if a collection is empty before iterating? That is, is there any argument for preferring option 2 in the following example? # Collection that may or may not be empty data = filter(x -\> x \> 0.75, ran…

---

## [Initialization of Packages on import](https://discourse.julialang.org/t/initialization-of-packages-on-import/13633)

<div class="topic-metadata">

**Author:** [@azraq27](https://discourse.julialang.org/u/azraq27)\
**Replies:** 6\
**Last updated:** [February 1, 2021, 8:40am UTC](https://discourse.julialang.org/t/initialization-of-packages-on-import/13633 "2021-02-01T08:40:54Z")

</div>

I’m still getting used to the new v0.7 Pkg (Pkg3), but I kind of wish I had more documentation on it. Overall looks cool, I’m just getting confused about some things. One specific change I’m struggling with is that it s…

---

## [Why doesn't convert(Symbol, "foo") work?](https://discourse.julialang.org/t/why-doesnt-convert-symbol-foo-work/54357)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 1\
**Last updated:** [February 1, 2021, 5:56am UTC](https://discourse.julialang.org/t/why-doesnt-convert-symbol-foo-work/54357 "2021-02-01T05:56:42Z")

</div>

Since the Symbol constructor works, is there a reason why convert(Symbol, "foo") shouldn’t work? julia\> Symbol("foo") :foo julia\> convert(Symbol, "foo") ERROR: MethodError: Cannot \`convert\` an object of type String to …

---

## [Nteract troubles](https://discourse.julialang.org/t/nteract-troubles/54356)

<div class="topic-metadata">

**Author:** [@jebej](https://discourse.julialang.org/u/jebej)\
**Replies:** 0\
**Last updated:** [February 1, 2021, 3:50am UTC](https://discourse.julialang.org/t/nteract-troubles/54356 "2021-02-01T03:50:08Z")

</div>

I can use nteract, but the syntax highlighting is wrong, and autocompletion (ctrl-space) does not work at all. From seeing a few posts here it appears that these should work. Is any special configuration needed? This is…

---

## [Global constants that cannot be defined until runtime because they depend on specifics of the CPU architecture](https://discourse.julialang.org/t/global-constants-that-cannot-be-defined-until-runtime-because-they-depend-on-specifics-of-the-cpu-architecture/54077)

<div class="topic-metadata">

**Author:** [@dilumaluthge](https://discourse.julialang.org/u/dilumaluthge)\
**Replies:** 7\
**Last updated:** [February 1, 2021, 2:23am UTC](https://discourse.julialang.org/t/global-constants-that-cannot-be-defined-until-runtime-because-they-depend-on-specifics-of-the-cpu-architecture/54077 "2021-02-01T02:23:32Z")

</div>

@elrod and I are running into problems when trying to make LoopVectorization.jl relocatable. (for example, compiling a sysimage that includes LoopVectorization.jl on machine A, and then using that sysimage on machine B). …

---

## [What’s the correct way to convert \`Dates.unix2datetime(mtime(fpath))\` to a datetim](https://discourse.julialang.org/t/what-s-the-correct-way-to-convert-dates-unix2datetime-mtime-fpath-to-a-datetim/54353)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 1, 2021, 1:50am UTC](https://discourse.julialang.org/t/what-s-the-correct-way-to-convert-dates-unix2datetime-mtime-fpath-to-a-datetim/54353 "2021-02-01T01:50:19Z")

</div>

What’s the correct way to convert Dates.unix2datetime(mtime(fpath)) to a datetime with the correct time zone for my system? I get a time 5 hours in the future, so I assume it’s returning UTC. julia&gt; Dates.unix2datet…

---

## [\`&\` does not appear to shortcircuit but \`&&\` does not work, is ther](https://discourse.julialang.org/t/does-not-appear-to-shortcircuit-but-does-not-work-is-ther/54345)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 3\
**Last updated:** [January 31, 2021, 10:36pm UTC](https://discourse.julialang.org/t/does-not-appear-to-shortcircuit-but-does-not-work-is-ther/54345 "2021-01-31T22:36:36Z")

</div>

& does not appear to shortcircuit but && does not work, is there another operator for broadcasted short-circuiting logical AND? Note that the poster on Slack cannot see your response here on Discourse. Consider answeri…

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

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