# General Usage

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

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

**Page:** 754

---

## [Julia raspbian packaging query](https://discourse.julialang.org/t/julia-raspbian-packaging-query/38445)

<div class="topic-metadata">

**Author:** [@plugwash](https://discourse.julialang.org/u/plugwash)\
**Replies:** 2\
**Last updated:** [May 13, 2020, 2:13pm UTC](https://discourse.julialang.org/t/julia-raspbian-packaging-query/38445 "2020-05-13T14:13:15Z")

</div>

(apologies if this is the wrong forum, there didn’t seem to be a specific one for distro packaging queries) I maintain raspbian, an armv6 rebuild of Debian. I have been looking to update the julia package in raspbian bu…

---

## [Function like numpy.stack](https://discourse.julialang.org/t/function-like-numpy-stack/39394)

<div class="topic-metadata">

**Author:** [@ponez](https://discourse.julialang.org/u/ponez)\
**Replies:** 2\
**Last updated:** [May 13, 2020, 1:40pm UTC](https://discourse.julialang.org/t/function-like-numpy-stack/39394 "2020-05-13T13:40:06Z")

</div>

Is there any function like numpy.stack(arrays, axis=)，I’ve tried repeat(a, inner=()), but this method can’t specify axis, and reshape after repeat doesn’t work. julia\> a 2-element Array{Int64,1}: 2 1 julia\> c = repeat…

---

## [Function not faster than global scope](https://discourse.julialang.org/t/function-not-faster-than-global-scope/39389)

<div class="topic-metadata">

**Author:** [@JasonHall](https://discourse.julialang.org/u/JasonHall)\
**Replies:** 7\
**Last updated:** [May 13, 2020, 12:39pm UTC](https://discourse.julialang.org/t/function-not-faster-than-global-scope/39389 "2020-05-13T12:39:34Z")

</div>

I am following along in Adrian Salceanu’s book “Julia Programming Projects”. He is on Julia 1.0 and I am using 1.4. He says that running in the global scope is slower than wrapping in a function because the function is…

---

## [Some variable not defined, even though it is](https://discourse.julialang.org/t/some-variable-not-defined-even-though-it-is/39386)

<div class="topic-metadata">

**Author:** [@HoldenCaulfield](https://discourse.julialang.org/u/HoldenCaulfield)\
**Replies:** 7\
**Last updated:** [May 13, 2020, 11:35am UTC](https://discourse.julialang.org/t/some-variable-not-defined-even-though-it-is/39386 "2020-05-13T11:35:44Z")

</div>

Hi, I have two similar functions, for training a Boltzmann machine. Here’s the first: function train(ptrns, n\_h, ϵ, n\_G\_s, steps) w = rand(Normal(0,0.01),size(ptrns,2)+1, n\_h+1) h = hcat(zeros(1,n\_h),1); hi…

---

## [Converting a matrix into an array of arrays](https://discourse.julialang.org/t/converting-a-matrix-into-an-array-of-arrays/17038)

<div class="topic-metadata">

**Author:** [@braamvandyk](https://discourse.julialang.org/u/braamvandyk)\
**Replies:** 7\
**Last updated:** [May 13, 2020, 11:11am UTC](https://discourse.julialang.org/t/converting-a-matrix-into-an-array-of-arrays/17038 "2020-05-13T11:11:18Z")

</div>

Hi all I have seen many examples of converting an array of arrays into a matrix, but I would like to go the other way. What I have cobbled together works, but may not be the most elegant or fast solution. I would apprec…

---

## [Run() returns not recognized as an internal or external command](https://discourse.julialang.org/t/run-returns-not-recognized-as-an-internal-or-external-command/39343)

<div class="topic-metadata">

**Author:** [@1634](https://discourse.julialang.org/u/1634)\
**Replies:** 2\
**Last updated:** [May 13, 2020, 10:54am UTC](https://discourse.julialang.org/t/run-returns-not-recognized-as-an-internal-or-external-command/39343 "2020-05-13T10:54:10Z")

</div>

Hi community, I tried to run linux commands in Julia through run(pipeline(\`cmd /c Rscript x.R\`, \`cmd /c gzip\`, \`cmd /c julia xx.jl\`) |\> file) but then I get ‘Rscript’ is not recognized as an internal or external c…

---

## [Iterating over the columns of a matrix](https://discourse.julialang.org/t/iterating-over-the-columns-of-a-matrix/39385)

<div class="topic-metadata">

**Author:** [@BMO](https://discourse.julialang.org/u/BMO)\
**Replies:** 3\
**Last updated:** [May 13, 2020, 10:49am UTC](https://discourse.julialang.org/t/iterating-over-the-columns-of-a-matrix/39385 "2020-05-13T10:49:12Z")

</div>

I want to iterate a function whose argument is a vector. The vectors to iterate on are the columns of a matrix. I was “slicing” the matrix into columns following Converting a matrix into an array of arrays and then itera…

---

## [Makie recipe specialisation for specific types?](https://discourse.julialang.org/t/makie-recipe-specialisation-for-specific-types/39157)

<div class="topic-metadata">

**Author:** [@Ward9250](https://discourse.julialang.org/u/Ward9250)\
**Replies:** 5\
**Last updated:** [May 13, 2020, 4:05am UTC](https://discourse.julialang.org/t/makie-recipe-specialisation-for-specific-types/39157 "2020-05-13T04:05:28Z")

</div>

Hiya, so this is a bit of a weird thing to own up to, but this is the first time I’ve ever seriously sat down and thought - right this BioJulia package needs to plotting functionality! (I know right, normally I’m obsesse…

---

## [How to create tree from struct](https://discourse.julialang.org/t/how-to-create-tree-from-struct/39372)

<div class="topic-metadata">

**Author:** [@wiktorkujawa](https://discourse.julialang.org/u/wiktorkujawa)\
**Replies:** 4\
**Last updated:** [May 13, 2020, 9:08am UTC](https://discourse.julialang.org/t/how-to-create-tree-from-struct/39372 "2020-05-13T09:08:46Z")

</div>

I want to create tree with struct. Here’s my approach: mutable struct node{T} data::T left::node right::node node(T)= (data=T; left= Nothing; right= Nothing) end root=node(1) root.left=node(2) root.right=node(3…

---

## [Packages: build, precompile and add](https://discourse.julialang.org/t/packages-build-precompile-and-add/39281)

<div class="topic-metadata">

**Author:** [@v-i-s-h](https://discourse.julialang.org/u/v-i-s-h)\
**Replies:** 3\
**Last updated:** [May 13, 2020, 4:56am UTC](https://discourse.julialang.org/t/packages-build-precompile-and-add/39281 "2020-05-13T04:56:04Z")

</div>

When I install some packages, upon first use it shows messages about building and/or precompile. Why these build/precompile tasks are not completed during the install phase itself? Now I do a manual build and precompile …

---

## [Passing a string into function as a expression](https://discourse.julialang.org/t/passing-a-string-into-function-as-a-expression/31625)

<div class="topic-metadata">

**Author:** [@ke\_xu](https://discourse.julialang.org/u/ke_xu)\
**Replies:** 17\
**Last updated:** [May 12, 2020, 9:58pm UTC](https://discourse.julialang.org/t/passing-a-string-into-function-as-a-expression/31625 "2020-05-12T21:58:40Z")

</div>

function Compare(a,b,c::String) d = Meta.parse(c) if eval(d) true else false end end Compare(1,1,"a\>b") I tried to compare two integers by a customized expression, like the function above…

---

## [@fastmath macro accuracy](https://discourse.julialang.org/t/fastmath-macro-accuracy/38847)

<div class="topic-metadata">

**Author:** [@s-baumann](https://discourse.julialang.org/u/s-baumann)\
**Replies:** 26\
**Last updated:** [May 12, 2020, 9:06pm UTC](https://discourse.julialang.org/t/fastmath-macro-accuracy/38847 "2020-05-12T21:06:42Z")

</div>

As I understand it @fastmath explores whatever functions you write and replaces them with fast and rough versions of these functions. For instance rather than the proper exp function you get a faster and less accurate ve…

---

## [How to get Automa to work with stdin?](https://discourse.julialang.org/t/how-to-get-automa-to-work-with-stdin/39360)

<div class="topic-metadata">

**Author:** [@lesshaste](https://discourse.julialang.org/u/lesshaste)\
**Replies:** 2\
**Last updated:** [May 12, 2020, 8:25pm UTC](https://discourse.julialang.org/t/how-to-get-automa-to-work-with-stdin/39360 "2020-05-12T20:25:00Z")

</div>

I have some code which parses a string using Automa. I believe it simply travels through the string from left to right. I would like to make it work on a string coming from stdin but I am not sure how to do it. Here is …

---

## [Union troubles](https://discourse.julialang.org/t/union-troubles/39340)

<div class="topic-metadata">

**Author:** [@maarten\_van\_damme](https://discourse.julialang.org/u/maarten_van_damme)\
**Replies:** 7\
**Last updated:** [May 12, 2020, 4:50pm UTC](https://discourse.julialang.org/t/union-troubles/39340 "2020-05-12T16:50:08Z")

</div>

I want to define a type that is effectively a vector of a matrix of operators. However, if the operator has norm zero or is proportional to the identity then we can simplify the necessary operations =\> we want to store t…

---

## [Very slow pre-compiling and \`using\`of custom Julia package](https://discourse.julialang.org/t/very-slow-pre-compiling-and-using-of-custom-julia-package/24708)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 3\
**Last updated:** [May 12, 2020, 4:12pm UTC](https://discourse.julialang.org/t/very-slow-pre-compiling-and-using-of-custom-julia-package/24708 "2020-05-12T16:12:10Z")

</div>

I’ve been working on a Julia package at work, call it Unicorns.jl. The package is currently in dev mode. Whenever I make changes to the source and then call using Unicorns (yes, I know about Revise.jl), it takes a very l…

---

## [Problem in upgrading Atom to Julia 1.4](https://discourse.julialang.org/t/problem-in-upgrading-atom-to-julia-1-4/38749)

<div class="topic-metadata">

**Author:** [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Replies:** 9\
**Last updated:** [May 12, 2020, 4:03pm UTC](https://discourse.julialang.org/t/problem-in-upgrading-atom-to-julia-1-4/38749 "2020-05-12T16:03:10Z")

</div>

I have upgraded to Julia 1.4. On terminal, Julia runs smoothly but on Atom, the packages do not load. If I run using Pkg, for instance, the evaluator remains stuck. What might be the problem? Also, I tried to copy only…

---

## [Package Installation Failing April 2020 - JuliaDB, OnlineStats](https://discourse.julialang.org/t/package-installation-failing-april-2020-juliadb-onlinestats/38395)

<div class="topic-metadata">

**Author:** [@eyedia](https://discourse.julialang.org/u/eyedia)\
**Replies:** 6\
**Last updated:** [May 12, 2020, 3:02pm UTC](https://discourse.julialang.org/t/package-installation-failing-april-2020-juliadb-onlinestats/38395 "2020-05-12T15:02:07Z")

</div>

Seems like error has something to do with JuliaDB, OnlineStats, but not sure. Just execute below code: using Pkg Pkg.add(“CSV”) Pkg.add(“DataFrames”) Pkg.add(“HTTP”) Pkg.add(“JSON”) Pkg.add(“JuliaDB”) Pkg.add(“Mb…

---

## [Size vs length](https://discourse.julialang.org/t/size-vs-length/37101)

<div class="topic-metadata">

**Author:** [@isentropic](https://discourse.julialang.org/u/isentropic)\
**Replies:** 13\
**Last updated:** [May 12, 2020, 1:28pm UTC](https://discourse.julialang.org/t/size-vs-length/37101 "2020-05-12T13:28:45Z")

</div>

I wonder why the performance of size is so much faster when it comes to matrices: julia\> a = rand(100,2) 100×2 Array{Float64,2}: 0.47076 0.605881 0.0432887 0.318102 0.12271 0.121367 0.0737559 0.885239 0.389…

---

## [Is there any way to speed up Documenter a bit?](https://discourse.julialang.org/t/is-there-any-way-to-speed-up-documenter-a-bit/39345)

<div class="topic-metadata">

**Author:** [@Xing\_Shi\_Cai](https://discourse.julialang.org/u/Xing_Shi_Cai)\
**Replies:** 2\
**Last updated:** [May 12, 2020, 12:54pm UTC](https://discourse.julialang.org/t/is-there-any-way-to-speed-up-documenter-a-bit/39345 "2020-05-12T12:54:19Z")

</div>

I use Documenter to build a fairly small site with very few pages. But it still takes two and a half minutes for it to finish. This makes fixing things and seeing the change very tedious. Is there a way to speed things u…

---

## [How fast can Plots.jl work after being compiled with PackageCompiler?](https://discourse.julialang.org/t/how-fast-can-plots-jl-work-after-being-compiled-with-packagecompiler/39314)

<div class="topic-metadata">

**Author:** [@Xing\_Shi\_Cai](https://discourse.julialang.org/u/Xing_Shi_Cai)\
**Replies:** 13\
**Last updated:** [May 12, 2020, 12:47pm UTC](https://discourse.julialang.org/t/how-fast-can-plots-jl-work-after-being-compiled-with-packagecompiler/39314 "2020-05-12T12:47:37Z")

</div>

I just tried using PackageComipler on Plots.jl. With precompiled images, I got julia\> @time using Plots 0.891786 seconds (1.26 M allocations: 59.289 MiB, 16.97% gc time) julia\> @time (p = plot(rand(5), rand(5)); disp…

---

## [Are packages which I download from GitHub secure?](https://discourse.julialang.org/t/are-packages-which-i-download-from-github-secure/39334)

<div class="topic-metadata">

**Author:** [@DKad](https://discourse.julialang.org/u/DKad)\
**Replies:** 1\
**Last updated:** [May 12, 2020, 11:49am UTC](https://discourse.julialang.org/t/are-packages-which-i-download-from-github-secure/39334 "2020-05-12T11:49:44Z")

</div>

Noticing strange behaviour of a package in julia, I don’t know which is the culprit: Is the downloading of packages from Github secure? My system is OpenSuse Leap 15.1, my julia has version 1.4.1. After running include…

---

## [Parametric type that can "act" as its parameter type](https://discourse.julialang.org/t/parametric-type-that-can-act-as-its-parameter-type/39339)

<div class="topic-metadata">

**Author:** [@rlrs](https://discourse.julialang.org/u/rlrs)\
**Replies:** 2\
**Last updated:** [May 12, 2020, 11:04am UTC](https://discourse.julialang.org/t/parametric-type-that-can-act-as-its-parameter-type/39339 "2020-05-12T11:04:20Z")

</div>

I’m trying to write a type, let’s call it Hole{T}, which can be assigned to a field of type T in a struct. Is this possible to do? I realize it might be quite weird type-wise, but if my other option is to rewrite all my …

---

## [Defining structs inside functions during runtime (versioned structs design? value types?)](https://discourse.julialang.org/t/defining-structs-inside-functions-during-runtime-versioned-structs-design-value-types/39315)

<div class="topic-metadata">

**Author:** [@tamasgal](https://discourse.julialang.org/u/tamasgal)\
**Replies:** 10\
**Last updated:** [May 12, 2020, 7:58am UTC](https://discourse.julialang.org/t/defining-structs-inside-functions-during-runtime-versioned-structs-design-value-types/39315 "2020-05-12T07:58:30Z")

</div>

I need help (again) with macros. This was driving me crazy today, although I found quite a few “related” posts, nothing worked to achieve what I want so I start to think that I am working on a horribly bad design. I deci…

---

## [Blog-post -- Euclidean Plane Geometry with Julia](https://discourse.julialang.org/t/blog-post-euclidean-plane-geometry-with-julia/39172)

<div class="topic-metadata">

**Author:** [@Xing\_Shi\_Cai](https://discourse.julialang.org/u/Xing_Shi_Cai)\
**Replies:** 2\
**Last updated:** [May 12, 2020, 4:16am UTC](https://discourse.julialang.org/t/blog-post-euclidean-plane-geometry-with-julia/39172 "2020-05-12T04:16:24Z")

</div>

Hi everyone, I just wrote a new blog post about doing a bit basic geometry with Julia.

---

## [Purpose of reduce(Array, Array)](https://discourse.julialang.org/t/purpose-of-reduce-array-array/39294)

<div class="topic-metadata">

**Author:** [@bpou](https://discourse.julialang.org/u/bpou)\
**Replies:** 5\
**Last updated:** [May 12, 2020, 3:45am UTC](https://discourse.julialang.org/t/purpose-of-reduce-array-array/39294 "2020-05-12T03:45:10Z")

</div>

Hello, I’m wondering what the purpose of reduce is when given two arrays as only arguments. Here’s what I’ve observed: julia\> reduce(\[1\], \[4\]) 4 julia\> reduce(\[1, 2, 3\], \[4\]) 4 julia\> reduce(\[1, 2, 3\], \[1\]) 1 ju…

---

## [SharedArray with mixed types of elements? Alternative functions?](https://discourse.julialang.org/t/sharedarray-with-mixed-types-of-elements-alternative-functions/39316)

<div class="topic-metadata">

**Author:** [@Jing\_Zhang](https://discourse.julialang.org/u/Jing_Zhang)\
**Replies:** 2\
**Last updated:** [May 12, 2020, 1:50am UTC](https://discourse.julialang.org/t/sharedarray-with-mixed-types-of-elements-alternative-functions/39316 "2020-05-12T01:50:57Z")

</div>

Hi Julia users, I am doing parallel computation using @distributed. The returned results will be a multi-dimensional array with mixed types of elements, such as Int64, Float64 and Spring. I was trying to use SharedArray…

---

## [Parallel loops and maps](https://discourse.julialang.org/t/parallel-loops-and-maps/39309)

<div class="topic-metadata">

**Author:** [@Jing\_Zhang](https://discourse.julialang.org/u/Jing_Zhang)\
**Replies:** 8\
**Last updated:** [May 12, 2020, 1:47am UTC](https://discourse.julialang.org/t/parallel-loops-and-maps/39309 "2020-05-12T01:47:06Z")

</div>

Dear Julia Users, I am running multiple layers of for loops. Within the for loops, it is a function named do\_one, which will return a 105000×34 DataFrame. I would want to combine these DataFrame to a larger DataFrame. C…

---

## [Anonymous functions with tuple arguments](https://discourse.julialang.org/t/anonymous-functions-with-tuple-arguments/3306)

<div class="topic-metadata">

**Author:** [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Replies:** 2\
**Last updated:** [May 11, 2020, 9:36pm UTC](https://discourse.julialang.org/t/anonymous-functions-with-tuple-arguments/3306 "2020-05-11T21:36:20Z")

</div>

I have a feeling this is a stupid question, but here it is anyway: Suppose I have a collection of tuples. Would it be possible to write anonymous function (x,y,…)-\>… where arguments are the tuple elements? An example: …

---

## [What does this error message mean](https://discourse.julialang.org/t/what-does-this-error-message-mean/39303)

<div class="topic-metadata">

**Author:** [@lewis](https://discourse.julialang.org/u/lewis)\
**Replies:** 7\
**Last updated:** [May 11, 2020, 9:29pm UTC](https://discourse.julialang.org/t/what-does-this-error-message-mean/39303 "2020-05-11T21:29:36Z")

</div>

It should be sort of obvious: I am redefining a const somewhere. Which const could it be? I have nothing named Variable anywhere. I only have 4 structs anywhere in the code. None redefine another. What is the refere…

---

## [Need help writing some recursive code please! Full code explanation and snapshot included](https://discourse.julialang.org/t/need-help-writing-some-recursive-code-please-full-code-explanation-and-snapshot-included/39306)

<div class="topic-metadata">

**Author:** [@Julia1](https://discourse.julialang.org/u/Julia1)\
**Replies:** 6\
**Last updated:** [May 11, 2020, 9:00pm UTC](https://discourse.julialang.org/t/need-help-writing-some-recursive-code-please-full-code-explanation-and-snapshot-included/39306 "2020-05-11T21:00:23Z")

</div>

Hi how’s it going? I’m trying to write this recursive code out and can’t get it to work. Can someone help me with a solution? Here is a code of the scenario. y = \[2,2,2,2,3,3,4\] x = \[1,2,3,3,2,2,2\] df = DataFrame(:colu…

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

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