# General Usage

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

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

**Page:** 682

---

## [Can I impose a super type for an existing struct?](https://discourse.julialang.org/t/can-i-impose-a-super-type-for-an-existing-struct/49460)

<div class="topic-metadata">

**Author:** [@giancarloantonucci](https://discourse.julialang.org/u/giancarloantonucci)\
**Replies:** 15\
**Last updated:** [November 4, 2020, 8:53am UTC](https://discourse.julialang.org/t/can-i-impose-a-super-type-for-an-existing-struct/49460 "2020-11-04T08:53:51Z")

</div>

As per title, can I impose my abstract type MyAbstractType end as a/the supertype for a pre-existing struct/type ExistingStruct coming from, say, a separate module? I just want ExistingStruct \<: MyAbstractType to ret…

---

## [Overloading vectorization?](https://discourse.julialang.org/t/overloading-vectorization/49526)

<div class="topic-metadata">

**Author:** [@bcsj](https://discourse.julialang.org/u/bcsj)\
**Replies:** 9\
**Last updated:** [November 4, 2020, 8:32am UTC](https://discourse.julialang.org/t/overloading-vectorization/49526 "2020-11-04T08:32:42Z")

</div>

So say I have a function, e.g. f(x,y) = x\*y and two arrays a=\[1,2\]; b=\[3,4\], then I can perform f element-wise by calling f.(a,b). But now f is a more complicated operation, f.(a,b) still works, but say I can write anot…

---

## [Weave unable to execute Maxima.jl](https://discourse.julialang.org/t/weave-unable-to-execute-maxima-jl/49560)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 0\
**Last updated:** [November 4, 2020, 2:22am UTC](https://discourse.julialang.org/t/weave-unable-to-execute-maxima-jl/49560 "2020-11-04T02:22:05Z")

</div>

When I try to Weave a Julia Markdown with Maxima.jl, it ends up not starting. using Maxima It just stays on the first block of code.

---

## [How to realize this multithreading function](https://discourse.julialang.org/t/how-to-realize-this-multithreading-function/49537)

<div class="topic-metadata">

**Author:** [@bluefog](https://discourse.julialang.org/u/bluefog)\
**Replies:** 2\
**Last updated:** [November 4, 2020, 1:07am UTC](https://discourse.julialang.org/t/how-to-realize-this-multithreading-function/49537 "2020-11-04T01:07:45Z")

</div>

Core 1 is constantly calculating x, and core 2 is constantly taking the value of X But did not debug through X, no shared program has been in the core 1 loop, please give me some advice, thank you #====================…

---

## [How to create strings combining all letters?](https://discourse.julialang.org/t/how-to-create-strings-combining-all-letters/49550)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 6\
**Last updated:** [November 4, 2020, 12:14am UTC](https://discourse.julialang.org/t/how-to-create-strings-combining-all-letters/49550 "2020-11-04T00:14:22Z")

</div>

Hello. I’m trying to learn Julia by replicating simple R code in Julia but I’m not even able to create a toy example :anguished: Let me ask some simple question. In R there is a function letters, which gives you a vec…

---

## [Which small, cheap, low power, system-on-chip computers run Julia?](https://discourse.julialang.org/t/which-small-cheap-low-power-system-on-chip-computers-run-julia/31379)

<div class="topic-metadata">

**Author:** [@robblackwell](https://discourse.julialang.org/u/robblackwell)\
**Replies:** 5\
**Last updated:** [November 3, 2020, 9:54pm UTC](https://discourse.julialang.org/t/which-small-cheap-low-power-system-on-chip-computers-run-julia/31379 "2020-11-03T21:54:52Z")

</div>

I’ve been demonstrating some Julia code for scientific data processing running on a Raspberry Pi. My message that the same code works on both high performance compute clusters and low end embedded systems seems power…

---

## [How to prohibit assignment to a variable in a function?](https://discourse.julialang.org/t/how-to-prohibit-assignment-to-a-variable-in-a-function/49544)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 2\
**Last updated:** [November 3, 2020, 6:57pm UTC](https://discourse.julialang.org/t/how-to-prohibit-assignment-to-a-variable-in-a-function/49544 "2020-11-03T18:57:28Z")

</div>

function f(x::Int) const y = 5 #some code... y =2 # I want this line to throw "ERROR: invalid redefinition of constant y" x+y end Instead it throws: ERROR: syntax: unsupported const declaration on …

---

## [Plots + plotlyjs + logscale + savefig](https://discourse.julialang.org/t/plots-plotlyjs-logscale-savefig/49548)

<div class="topic-metadata">

**Author:** [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)\
**Replies:** 0\
**Last updated:** [November 3, 2020, 6:50pm UTC](https://discourse.julialang.org/t/plots-plotlyjs-logscale-savefig/49548 "2020-11-03T18:50:00Z")

</div>

I have used Plots + with plotlyjs() backend and I am bit confused with the output of savefig() Please compare the following figure This one is is produced by savefig() This one is screenshot form VS Code plot pane …

---

## [Is there an outline for Julia Markdown?](https://discourse.julialang.org/t/is-there-an-outline-for-julia-markdown/49545)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 0\
**Last updated:** [November 3, 2020, 6:20pm UTC](https://discourse.julialang.org/t/is-there-an-outline-for-julia-markdown/49545 "2020-11-03T18:20:12Z")

</div>

When I run a Markdown in VS Code, I’m able to find an outline. This makes it easy to find materials, but I’m not able to find the same feature in Julia Markdown. Is there an outline avaliable? I might also want to set…

---

## [Type unstable function returning a tuple](https://discourse.julialang.org/t/type-unstable-function-returning-a-tuple/49493)

<div class="topic-metadata">

**Author:** [@Bigorneau](https://discourse.julialang.org/u/Bigorneau)\
**Replies:** 34\
**Last updated:** [November 3, 2020, 5:46pm UTC](https://discourse.julialang.org/t/type-unstable-function-returning-a-tuple/49493 "2020-11-03T17:46:13Z")

</div>

Good evening, I have been facing a (slightly) annoying type inference issue when writing a function which returns a tuple. Here is a minimal working example: f(v, ::Val{N}) where {N} = ntuple(i -\> sum(v\[1\]), N) # type…

---

## [BFGS very slow compared to BlackBoxOptim - How to improve performance](https://discourse.julialang.org/t/bfgs-very-slow-compared-to-blackboxoptim-how-to-improve-performance/49253)

<div class="topic-metadata">

**Author:** [@vsskanth](https://discourse.julialang.org/u/vsskanth)\
**Replies:** 20\
**Last updated:** [November 3, 2020, 3:58pm UTC](https://discourse.julialang.org/t/bfgs-very-slow-compared-to-blackboxoptim-how-to-improve-performance/49253 "2020-11-03T15:58:25Z")

</div>

I am trying to fit a differential equation (using DiffEqParamEstim) with these properties: Lumped parameter linear thermal model with 3 states 8 interpolated external inputs (sampled at 50 Hz) using Interpolations.jl o…

---

## [Iterating over String changes its Structure to a an array Characters](https://discourse.julialang.org/t/iterating-over-string-changes-its-structure-to-a-an-array-characters/49417)

<div class="topic-metadata">

**Author:** [@Jim\_Beck](https://discourse.julialang.org/u/Jim_Beck)\
**Replies:** 6\
**Last updated:** [November 3, 2020, 3:37pm UTC](https://discourse.julialang.org/t/iterating-over-string-changes-its-structure-to-a-an-array-characters/49417 "2020-11-03T15:37:02Z")

</div>

I have a list of strings that I’m attempting to compare to a unique other string. I have a function that compares each string character by character, counting differences at each location. function compareStrings(sequen…

---

## [Switch to the folder of open file in VS code](https://discourse.julialang.org/t/switch-to-the-folder-of-open-file-in-vs-code/44813)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 10\
**Last updated:** [November 3, 2020, 3:07pm UTC](https://discourse.julialang.org/t/switch-to-the-folder-of-open-file-in-vs-code/44813 "2020-11-03T15:07:49Z")

</div>

Is there a command to switch to the folder of the current file in VS code? I can see that there is a command to copy the name of the current file, but at least on Windows that path is unusable in Julia since it has si…

---

## [IJulia build problems again: solved](https://discourse.julialang.org/t/ijulia-build-problems-again-solved/49530)

<div class="topic-metadata">

**Author:** [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Replies:** 0\
**Last updated:** [November 3, 2020, 2:39pm UTC](https://discourse.julialang.org/t/ijulia-build-problems-again-solved/49530 "2020-11-03T14:39:08Z")

</div>

Reboot solved problems.

---

## [Get node indices in NearestNeighbors?](https://discourse.julialang.org/t/get-node-indices-in-nearestneighbors/49252)

<div class="topic-metadata">

**Author:** [@cgeoga](https://discourse.julialang.org/u/cgeoga)\
**Replies:** 4\
**Last updated:** [November 3, 2020, 2:39pm UTC](https://discourse.julialang.org/t/get-node-indices-in-nearestneighbors/49252 "2020-11-03T14:39:22Z")

</div>

Hey all— I’m building a KDTree using NearestNeighbors.jl like this: using StaticArrays, NearestNeighbors pts = \[SVector{2, Float64}(randn(2)) for \_ in 1:1024\] tree = KDTree(pts, leafsize=25) and I’m trying to find t…

---

## [How to change vertical to horizontal StringArray?](https://discourse.julialang.org/t/how-to-change-vertical-to-horizontal-stringarray/49522)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 1\
**Last updated:** [November 3, 2020, 1:15pm UTC](https://discourse.julialang.org/t/how-to-change-vertical-to-horizontal-stringarray/49522 "2020-11-03T13:15:27Z")

</div>

How to change vertical to horizontal StringArray ? julia\> plot(rand(3,2),labels=\["a", "b"\]) julia\> plot(rand(3,2),labels=\["a" "b"\]) Works fine only second line. How to change first to second vectors with lalbels ? Pa…

---

## [Static arrays being mutated, what is going on?](https://discourse.julialang.org/t/static-arrays-being-mutated-what-is-going-on/49519)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 3\
**Last updated:** [November 3, 2020, 1:03pm UTC](https://discourse.julialang.org/t/static-arrays-being-mutated-what-is-going-on/49519 "2020-11-03T13:03:23Z")

</div>

I do not understand how v3 is the code below is being allowed to mutate. What is going on there? using StaticArrays using BenchmarkTools function test(v1, v2) v3 = zeros(SVector{3,Float64}) for i in 1:10^4 …

---

## [How to find duplicate rows in String Array (vec)](https://discourse.julialang.org/t/how-to-find-duplicate-rows-in-string-array-vec/49182)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 2\
**Last updated:** [November 3, 2020, 1:01pm UTC](https://discourse.julialang.org/t/how-to-find-duplicate-rows-in-string-array-vec/49182 "2020-11-03T13:01:02Z")

</div>

How to find duplicate rows in String Array (vec) ? Paul

---

## [Julia support for GitHub Codespaces](https://discourse.julialang.org/t/julia-support-for-github-codespaces/46436)

<div class="topic-metadata">

**Author:** [@oschulz](https://discourse.julialang.org/u/oschulz)\
**Replies:** 6\
**Last updated:** [November 3, 2020, 12:18pm UTC](https://discourse.julialang.org/t/julia-support-for-github-codespaces/46436 "2020-11-03T12:18:34Z")

</div>

Just got my beta access to GitHub Codespaces (online VS code in GitHub). Codespaces allows for choosing a container to run in - but while there’s already lot’s of pre-built containers for Python, Java, Perl, Ruby, etc. t…

---

## [Unitful dispatch](https://discourse.julialang.org/t/unitful-dispatch/49480)

<div class="topic-metadata">

**Author:** [@KajWiik](https://discourse.julialang.org/u/KajWiik)\
**Replies:** 13\
**Last updated:** [November 3, 2020, 11:41am UTC](https://discourse.julialang.org/t/unitful-dispatch/49480 "2020-11-03T11:41:50Z")

</div>

Why this works: julia\> function hz(x::typeof(1.0u"Hz")) 2x end hz (generic function with 1 method) and this does not work: julia\> typeof(1.0u"Hz") Quantity{Float64,𝐓^-1,Unitful.FreeUnits{(Hz,),𝐓^-1,nothi…

---

## [What do you think of \`(f1 & f2)(x)\`?](https://discourse.julialang.org/t/what-do-you-think-of-f1-f2-x/49459)

<div class="topic-metadata">

**Author:** [@MarcMush](https://discourse.julialang.org/u/MarcMush)\
**Replies:** 2\
**Last updated:** [November 2, 2020, 3:55pm UTC](https://discourse.julialang.org/t/what-do-you-think-of-f1-f2-x/49459 "2020-11-02T15:55:27Z")

</div>

There might be a thread or a github issue about that but it’s really hard to search for or and and terms, please redirect me if I missed it I’d like to use a syntax that looks like that: f = \<(5) & \>(1) g = isnan | ism…

---

## [SVector vs struct performance](https://discourse.julialang.org/t/svector-vs-struct-performance/49503)

<div class="topic-metadata">

**Author:** [@arnief3](https://discourse.julialang.org/u/arnief3)\
**Replies:** 8\
**Last updated:** [November 3, 2020, 10:46am UTC](https://discourse.julialang.org/t/svector-vs-struct-performance/49503 "2020-11-03T10:46:14Z")

</div>

I am struggling to understand the huge performance difference I am seeing between these two approaches to creating a Vec3 DataType. I would prefer to use a SVector, but only if the performance is comparable. I feel like …

---

## [Differentials in ModelingToolkit](https://discourse.julialang.org/t/differentials-in-modelingtoolkit/49440)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 6\
**Last updated:** [November 3, 2020, 5:19am UTC](https://discourse.julialang.org/t/differentials-in-modelingtoolkit/49440 "2020-11-03T05:19:35Z")

</div>

I’m trying to find the derivative in ModelingToolkit.jl This is how it was done in SymEngine using SymEngine x=symbols(:x) diff(4x^3,x) would give 3x^2 How would I do the same thing in ModelingToolkit?

---

## [Symbols in Symbol Utilities](https://discourse.julialang.org/t/symbols-in-symbol-utilities/49498)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 0\
**Last updated:** [November 3, 2020, 2:37am UTC](https://discourse.julialang.org/t/symbols-in-symbol-utilities/49498 "2020-11-03T02:37:14Z")

</div>

I’m trying to use various CAS packages. I tried to follow the instructions for. Symbolic Utils Using SymbolicUtils @syms x diff(x^2+x,x) and I get ERROR: MethodError: no method matching diff(::Term{Number}, ::Sym{Nu…

---

## [Multithreading of a simple loop](https://discourse.julialang.org/t/multithreading-of-a-simple-loop/49478)

<div class="topic-metadata">

**Author:** [@JohnZ](https://discourse.julialang.org/u/JohnZ)\
**Replies:** 6\
**Last updated:** [November 3, 2020, 1:07am UTC](https://discourse.julialang.org/t/multithreading-of-a-simple-loop/49478 "2020-11-03T01:07:58Z")

</div>

Hi, I am trying to use multi-threading to parallelise a simple loop. The actual code is quite complex and I have given a simplified example. The multithreaded version runs slower than the single thread version. I have …

---

## [Jaccard distance of each combo of elements in 2 lists](https://discourse.julialang.org/t/jaccard-distance-of-each-combo-of-elements-in-2-lists/49483)

<div class="topic-metadata">

**Author:** [@lorb24](https://discourse.julialang.org/u/lorb24)\
**Replies:** 2\
**Last updated:** [November 2, 2020, 10:04pm UTC](https://discourse.julialang.org/t/jaccard-distance-of-each-combo-of-elements-in-2-lists/49483 "2020-11-02T22:04:44Z")

</div>

What’s the most efficient way to get the Jaccard distance of each combo of elements in 2 lists? Let’s say I have 2 arrays that look like this: x= "ap p le" "or an ge" "ap pl e" "ap pl e” ”or an ge" "ho ne yc ri sp ap …

---

## [ArchGDAL and GeoArrays error libgdal on windows 10](https://discourse.julialang.org/t/archgdal-and-geoarrays-error-libgdal-on-windows-10/49470)

<div class="topic-metadata">

**Author:** [@virgile-baudrot](https://discourse.julialang.org/u/virgile-baudrot)\
**Replies:** 3\
**Last updated:** [November 2, 2020, 8:53pm UTC](https://discourse.julialang.org/t/archgdal-and-geoarrays-error-libgdal-on-windows-10/49470 "2020-11-02T20:53:23Z")

</div>

When loading ArchGDAL or GeoArrays, i’ve the following error: ERROR: could not load library "libgdal-26.dll" Sometimes it’s "libgdal-4.dll" \[79e6a3ab\] Adapt v2.3.0 \[c9ce4bd3\] ArchGDAL v0.5.2 \[dce04be8\] ArgCheck v2…

---

## [Solving same DiffEq repeatedly but with different initial conditions](https://discourse.julialang.org/t/solving-same-diffeq-repeatedly-but-with-different-initial-conditions/49402)

<div class="topic-metadata">

**Author:** [@ash](https://discourse.julialang.org/u/ash)\
**Replies:** 2\
**Last updated:** [November 2, 2020, 8:14pm UTC](https://discourse.julialang.org/t/solving-same-diffeq-repeatedly-but-with-different-initial-conditions/49402 "2020-11-02T20:14:46Z")

</div>

I have a set of coupled ODEs that I’d like to solve, which is simple enough using DifferentialEquations.jl. My problem is that I need to solve the same ODE repeatedly for many different initial conditions parametrized by…

---

## [(Re)-installation of packages when changing Julia versions?](https://discourse.julialang.org/t/re-installation-of-packages-when-changing-julia-versions/49473)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 9\
**Last updated:** [November 2, 2020, 6:53pm UTC](https://discourse.julialang.org/t/re-installation-of-packages-when-changing-julia-versions/49473 "2020-11-02T18:53:06Z")

</div>

If we install the 1.6 development version and later want to upgrade to the upcoming final 1.6 version… Will we need to reinstall all packages again?

---

## [Can an earlier version of CUDA.jl work with CUDA6.5?](https://discourse.julialang.org/t/can-an-earlier-version-of-cuda-jl-work-with-cuda6-5/49374)

<div class="topic-metadata">

**Author:** [@compleat](https://discourse.julialang.org/u/compleat)\
**Replies:** 2\
**Last updated:** [November 2, 2020, 6:53pm UTC](https://discourse.julialang.org/t/can-an-earlier-version-of-cuda-jl-work-with-cuda6-5/49374 "2020-11-02T18:53:30Z")

</div>

I have hardware (and associated driver) that can only work with CUDA 6.5 The installation instructions for CUDA.jl state that CUDA 10.1 is required for the current version, but that earlier versions may work with earlie…

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

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