# General Usage

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

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

**Page:** 649

---

## [Installing the Polynomials Package on Jupyter](https://discourse.julialang.org/t/installing-the-polynomials-package-on-jupyter/54587)

<div class="topic-metadata">

**Author:** [@xdiploid](https://discourse.julialang.org/u/xdiploid)\
**Replies:** 0\
**Last updated:** [February 4, 2021, 3:21am UTC](https://discourse.julialang.org/t/installing-the-polynomials-package-on-jupyter/54587 "2021-02-04T03:21:46Z")

</div>

Is there a reason why this isn’t working to install the Polynomials package? Pkg.add("Polynomials") using Polynomials I tried running it in Julia terminal outside of Jupyter and that didn’t work either. I followed th…

---

## [Best practice for storing functions in a struct](https://discourse.julialang.org/t/best-practice-for-storing-functions-in-a-struct/9654)

<div class="topic-metadata">

**Author:** [@colintbowers](https://discourse.julialang.org/u/colintbowers)\
**Replies:** 31\
**Last updated:** [February 4, 2021, 2:23am UTC](https://discourse.julialang.org/t/best-practice-for-storing-functions-in-a-struct/9654 "2021-02-04T02:23:14Z")

</div>

Given that Function is an abstract type, I was wondering whether the following will impact performance on future function calls: struct FuncStruct f::Function end Should I instead be doing the following? struct Fu…

---

## [What algebraic properties should new operator methods have?](https://discourse.julialang.org/t/what-algebraic-properties-should-new-operator-methods-have/54576)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 0\
**Last updated:** [February 4, 2021, 1:15am UTC](https://discourse.julialang.org/t/what-algebraic-properties-should-new-operator-methods-have/54576 "2021-02-04T01:15:14Z")

</div>

Operator Precedence and Associativity has syntax rules for various operators and a footnote says: The operators + , ++ and \* are non-associative. I am wondering about the semantics of various operator methods. Are …

---

## [Weird performance sensitivity to order of operations in broadcasted expression](https://discourse.julialang.org/t/weird-performance-sensitivity-to-order-of-operations-in-broadcasted-expression/54568)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 4\
**Last updated:** [February 3, 2021, 11:33pm UTC](https://discourse.julialang.org/t/weird-performance-sensitivity-to-order-of-operations-in-broadcasted-expression/54568 "2021-02-03T23:33:26Z")

</div>

I’m seeing a weird performance sensitivity to order of operations. foo1(x,y) = @. x\*(x + y) + y\*y foo2(x,y) = @. (x + y)\*x + y\*y For StaticArray inputs, the first function allocates, while the second function does not. …

---

## [Hey all, super confused by variables scope in Julia. I have the following function](https://discourse.julialang.org/t/hey-all-super-confused-by-variables-scope-in-julia-i-have-the-following-function/54566)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 3, 2021, 10:57pm UTC](https://discourse.julialang.org/t/hey-all-super-confused-by-variables-scope-in-julia-i-have-the-following-function/54566 "2021-02-03T22:57:14Z")

</div>

Hey all, super confused by variables scope in Julia. I have the following function function init\_agents(;teams, workpatterns)::Vector{Agent} # print(typeof(teams), " ", typeof(workpatterns)) for (teamname, info)…

---

## [How to debug killed julia session?](https://discourse.julialang.org/t/how-to-debug-killed-julia-session/54546)

<div class="topic-metadata">

**Author:** [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Replies:** 6\
**Last updated:** [February 3, 2021, 8:00pm UTC](https://discourse.julialang.org/t/how-to-debug-killed-julia-session/54546 "2021-02-03T20:00:07Z")

</div>

I have a script that I’m trying to run that keeps getting killed after running for a bit and generating some amount of output. I have a list of identifiers for groups of files, and the program does read list of identif…

---

## [File access error on Arch: ERROR: IOError: stat: permission denied (EACCES) for file "/usr/bin/../etc/julia/startup.jl"](https://discourse.julialang.org/t/file-access-error-on-arch-error-ioerror-stat-permission-denied-eacces-for-file-usr-bin-etc-julia-startup-jl/54549)

<div class="topic-metadata">

**Author:** [@r-cheologist](https://discourse.julialang.org/u/r-cheologist)\
**Replies:** 5\
**Last updated:** [February 3, 2021, 6:40pm UTC](https://discourse.julialang.org/t/file-access-error-on-arch-error-ioerror-stat-permission-denied-eacces-for-file-usr-bin-etc-julia-startup-jl/54549 "2021-02-03T18:40:49Z")

</div>

Trying to play around with julia on Archlinux, I installed the julia package and generated a tiny printing script. When run like so: $ julia hello.jl I get this error: ERROR: IOError: stat: permission denied…

---

## [Bukdu, How to use a Timer](https://discourse.julialang.org/t/bukdu-how-to-use-a-timer/54531)

<div class="topic-metadata">

**Author:** [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Replies:** 3\
**Last updated:** [February 3, 2021, 6:25pm UTC](https://discourse.julialang.org/t/bukdu-how-to-use-a-timer/54531 "2021-02-03T18:25:28Z")

</div>

When run \>julia server.jl The Timer is not triggered. Is this caused by Bukdu? Thanks! #server.jl using Bukdu using HTTP const g\_temp\_data = Ref{String} function do\_work(t) g\_temp\_data\[\] ="Hello the word" pri…

---

## [Arrow.write on NamedTuple](https://discourse.julialang.org/t/arrow-write-on-namedtuple/54538)

<div class="topic-metadata">

**Author:** [@atteson](https://discourse.julialang.org/u/atteson)\
**Replies:** 2\
**Last updated:** [February 3, 2021, 5:29pm UTC](https://discourse.julialang.org/t/arrow-write-on-namedtuple/54538 "2021-02-03T17:29:33Z")

</div>

The Arrow.jl documentation seems to indicate that I can use Arrow.write on NamedTuple’s of AbstractVector’s. Can anyone help me understand why the following code doesn’t work: using Arrow Arrow.write( "test", (x=collec…

---

## [OrderedCollections: Not binary-compatible with prior version?](https://discourse.julialang.org/t/orderedcollections-not-binary-compatible-with-prior-version/54540)

<div class="topic-metadata">

**Author:** [@PGS62](https://discourse.julialang.org/u/PGS62)\
**Replies:** 2\
**Last updated:** [February 3, 2021, 5:15pm UTC](https://discourse.julialang.org/t/orderedcollections-not-binary-compatible-with-prior-version/54540 "2021-02-03T17:15:51Z")

</div>

I think OrderedCollections breaks “binary-compatibility” between the latest version 1.3.3 and the prior version 1.3.2. Here’s what I mean: I’m using version 1.3.2 and have model where typeof(model) == OrderedCollectio…

---

## [Why don’t different non-optional keyword parameters specify multiple dispatches](https://discourse.julialang.org/t/why-don-t-different-non-optional-keyword-parameters-specify-multiple-dispatches/54500)

<div class="topic-metadata">

**Author:** [@frankwswang](https://discourse.julialang.org/u/frankwswang)\
**Replies:** 4\
**Last updated:** [February 3, 2021, 4:45pm UTC](https://discourse.julialang.org/t/why-don-t-different-non-optional-keyword-parameters-specify-multiple-dispatches/54500 "2021-02-03T16:45:50Z")

</div>

julia\> foo(a; b, d="d", e="e") = (@show a b d e) foo (generic function with 1 method) julia\> foo(a; m, d="d", e="e") = (@show a m d e) foo (generic function with 1 method) julia\> foo(a; b, c, d="d", e="e") = (@show a b…

---

## [Transparency in Plots](https://discourse.julialang.org/t/transparency-in-plots/54409)

<div class="topic-metadata">

**Author:** [@orestis](https://discourse.julialang.org/u/orestis)\
**Replies:** 2\
**Last updated:** [February 3, 2021, 4:41pm UTC](https://discourse.julialang.org/t/transparency-in-plots/54409 "2021-02-03T16:41:58Z")

</div>

Hello, I would like to plot a heatmap on top of a 2d map. Something like: plot(geometry) heatmap!(x, y, values) The heatmap is consisting of a lot of zeros and I would like to be able to have all those zeros mapping t…

---

## [I have a ThinkPad running Windows 10 that seems stuck on Updating Registry when I](https://discourse.julialang.org/t/i-have-a-thinkpad-running-windows-10-that-seems-stuck-on-updating-registry-when-i/54285)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 3, 2021, 2:31pm UTC](https://discourse.julialang.org/t/i-have-a-thinkpad-running-windows-10-that-seems-stuck-on-updating-registry-when-i/54285 "2021-02-03T14:31:59Z")

</div>

I have a ThinkPad running Windows 10 that seems stuck on Updating Registry when I tried to add a package. In fact, after half an hour, it was still stuck. What could I do to make it go past updating registry? Note that …

---

## [How do I forcefully import all functions/macros from my Package into my testing en](https://discourse.julialang.org/t/how-do-i-forcefully-import-all-functions-macros-from-my-package-into-my-testing-en/54529)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 3, 2021, 2:08pm UTC](https://discourse.julialang.org/t/how-do-i-forcefully-import-all-functions-macros-from-my-package-into-my-testing-en/54529 "2021-02-03T14:08:58Z")

</div>

How do I forcefully import all functions/macros from my Package into my testing environment. I currently have this monstrosity at the top of my runtests.jl import AutoActuary: add\_namespace, add\_t\_index, has\_symbol, is\_…

---

## [MLJ Results display error](https://discourse.julialang.org/t/mlj-results-display-error/54532)

<div class="topic-metadata">

**Author:** [@compleat](https://discourse.julialang.org/u/compleat)\
**Replies:** 2\
**Last updated:** [February 3, 2021, 1:49pm UTC](https://discourse.julialang.org/t/mlj-results-display-error/54532 "2021-02-03T13:49:48Z")

</div>

Hi. I have run the first intro example in MLJ (in Jupyter), and it seems to have run OK, but the display of the results seems garbled: evaluate(my\_tree\_model, X, y, resampling=CV(shuffle=true), measure=c…

---

## [Registrator complains about \[compat\]. Fixed it. What's next?](https://discourse.julialang.org/t/registrator-complains-about-compat-fixed-it-whats-next/50996)

<div class="topic-metadata">

**Author:** [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Replies:** 25\
**Last updated:** [February 3, 2021, 10:12am UTC](https://discourse.julialang.org/t/registrator-complains-about-compat-fixed-it-whats-next/50996 "2021-02-03T10:12:03Z")

</div>

I’m trying to register a package for the first time. I have never done this before. As you can see, I am very confused. Registrator says The following dependencies do not have a \`\[compat\]\` entry. I fixed that in the P…

---

## [Customize a floating type to display different precisions](https://discourse.julialang.org/t/customize-a-floating-type-to-display-different-precisions/54510)

<div class="topic-metadata">

**Author:** [@Zq\_F](https://discourse.julialang.org/u/Zq_F)\
**Replies:** 3\
**Last updated:** [February 3, 2021, 8:15am UTC](https://discourse.julialang.org/t/customize-a-floating-type-to-display-different-precisions/54510 "2021-02-03T08:15:19Z")

</div>

Customize a floating type to display different precisions Hello, everyone I want to customize a floating type to display three decimal places, such as displaying 3.141 I have used the following sentence before show(i…

---

## [Is it normal for \`include\` to take a long time? I have a file, say \`model.jl\` that](https://discourse.julialang.org/t/is-it-normal-for-include-to-take-a-long-time-i-have-a-file-say-model-jl-that/54513)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 3, 2021, 5:12am UTC](https://discourse.julialang.org/t/is-it-normal-for-include-to-take-a-long-time-i-have-a-file-say-model-jl-that/54513 "2021-02-03T05:12:12Z")

</div>

Is it normal for include to take a long time? I have a file, say model.jl that includes only functions and the following header: using DifferentialEquations using Parameters using Gnuplot using CSV using DataFrames usin…

---

## [When designing a macro, what is the best error type to throw for what could be see](https://discourse.julialang.org/t/when-designing-a-macro-what-is-the-best-error-type-to-throw-for-what-could-be-see/54451)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 3\
**Last updated:** [February 3, 2021, 5:09am UTC](https://discourse.julialang.org/t/when-designing-a-macro-what-is-the-best-error-type-to-throw-for-what-could-be-see/54451 "2021-02-03T05:09:19Z")

</div>

When designing a macro, what is the best error type to throw for what could be seen as a “syntax error”? Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appro…

---

## [Keeping track of processes with \`wait=false\`](https://discourse.julialang.org/t/keeping-track-of-processes-with-wait-false/54504)

<div class="topic-metadata">

**Author:** [@cgeoga](https://discourse.julialang.org/u/cgeoga)\
**Replies:** 2\
**Last updated:** [February 3, 2021, 3:06am UTC](https://discourse.julialang.org/t/keeping-track-of-processes-with-wait-false/54504 "2021-02-03T03:06:41Z")

</div>

Hi all— I have a little piece of code that that opens up a file using run(xdg-open $file, wait=false) (removing the inner back ticks for better rendering). I’d really like to work out some way to keep track of these pro…

---

## [Ugly stacktraces in IJulia in 1.6](https://discourse.julialang.org/t/ugly-stacktraces-in-ijulia-in-1-6/54507)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 0\
**Last updated:** [February 3, 2021, 2:26am UTC](https://discourse.julialang.org/t/ugly-stacktraces-in-ijulia-in-1-6/54507 "2021-02-03T02:26:59Z")

</div>

I wasn’t sure if this is better an IJulia or a Julia (or even Jupyter) issue, so posting here for comments / ideas. The new 1.6 stack traces are beautiful and so much easier to read (thanks!), but because in IJulia they…

---

## [CUDA sum kernels, threads and blocks, complex values](https://discourse.julialang.org/t/cuda-sum-kernels-threads-and-blocks-complex-values/54490)

<div class="topic-metadata">

**Author:** [@ozmaden](https://discourse.julialang.org/u/ozmaden)\
**Replies:** 2\
**Last updated:** [February 3, 2021, 12:32am UTC](https://discourse.julialang.org/t/cuda-sum-kernels-threads-and-blocks-complex-values/54490 "2021-02-03T00:32:43Z")

</div>

Hi there, I was trying to implement a custom sum-dot-product-thingy using CUDA.jl kernels when I stumbled upon this documentation PR. It stems from a discussion had not too long ago here. I probably do not understand so…

---

## [How to efficiently find the breaking dependency](https://discourse.julialang.org/t/how-to-efficiently-find-the-breaking-dependency/54497)

<div class="topic-metadata">

**Author:** [@mannydepresso](https://discourse.julialang.org/u/mannydepresso)\
**Replies:** 0\
**Last updated:** [February 2, 2021, 11:38pm UTC](https://discourse.julialang.org/t/how-to-efficiently-find-the-breaking-dependency/54497 "2021-02-02T23:38:18Z")

</div>

Hi! Suppose I have a package A that I wrote myself, and I add it to a separate project environment B. I test A in A by running using Pkg Pkg.activate("A/") Pkg.test("A") and the tests fail. However, if I do the same t…

---

## [I made examples of wrapping jl code from Fortran & C; how generalize?](https://discourse.julialang.org/t/i-made-examples-of-wrapping-jl-code-from-fortran-c-how-generalize/52622)

<div class="topic-metadata">

**Author:** [@barnett567](https://discourse.julialang.org/u/barnett567)\
**Replies:** 6\
**Last updated:** [February 2, 2021, 11:01pm UTC](https://discourse.julialang.org/t/i-made-examples-of-wrapping-jl-code-from-fortran-c-how-generalize/52622 "2021-02-02T23:01:03Z")

</div>

I am interested in calling Julia from Fortran (eg F90), and since I couldn’t find any, I built an example of that which goes through a C wrapper layer; see here: https://github.com/ahbarnett/multilingual-julia It adapt…

---

## [How can I write a neural network using ForwardDiff.jl package?](https://discourse.julialang.org/t/how-can-i-write-a-neural-network-using-forwarddiff-jl-package/54408)

<div class="topic-metadata">

**Author:** [@DeepQ](https://discourse.julialang.org/u/DeepQ)\
**Replies:** 7\
**Last updated:** [February 2, 2021, 9:47pm UTC](https://discourse.julialang.org/t/how-can-i-write-a-neural-network-using-forwarddiff-jl-package/54408 "2021-02-02T21:47:30Z")

</div>

I want to write a neural network using ForwardDiff.jl package but I can’t find any example.

---

## [Say I have an array of symbols \`\[:w, :z, :c\]\` , how can I use it as a sorting ord](https://discourse.julialang.org/t/say-i-have-an-array-of-symbols-w-z-c-how-can-i-use-it-as-a-sorting-ord/54492)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 2, 2021, 9:30pm UTC](https://discourse.julialang.org/t/say-i-have-an-array-of-symbols-w-z-c-how-can-i-use-it-as-a-sorting-ord/54492 "2021-02-02T21:30:39Z")

</div>

Say that I have an array of Tuples \[(:c, 2), (:z, 2), (:w, 2)\] and I want to sort it such that I get \[(:w, 2), (:z, 2), (:c, 2)\] , i.e. that the symbols are in the same order as in \[:w, :z, :c\] Note that the original po…

---

## [Using \`\<:\`(subtype evaluate-operator) in the Conditional Evaluation (if-else)](https://discourse.julialang.org/t/using-subtype-evaluate-operator-in-the-conditional-evaluation-if-else/54309)

<div class="topic-metadata">

**Author:** [@frankwswang](https://discourse.julialang.org/u/frankwswang)\
**Replies:** 5\
**Last updated:** [February 2, 2021, 7:07pm UTC](https://discourse.julialang.org/t/using-subtype-evaluate-operator-in-the-conditional-evaluation-if-else/54309 "2021-02-02T19:07:54Z")

</div>

MWE: julia\> a = \[1,2\] 2-element Array{Int64,1}: 1 2 julia\> typeof(a) \<: Array{\<:AbstractArray, 1} false julia\> if typeof(a) \<: Array{\<:AbstractArray, 1} == false println("False!") end julia\> if typeof…

---

## [Trying to understand what LoopVectorization does/doesn’t like.If I broadcast-add](https://discourse.julialang.org/t/trying-to-understand-what-loopvectorization-does-doesn-t-like-if-i-broadcast-add/54468)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 3\
**Last updated:** [February 2, 2021, 5:32pm UTC](https://discourse.julialang.org/t/trying-to-understand-what-loopvectorization-does-doesn-t-like-if-i-broadcast-add/54468 "2021-02-02T17:32:18Z")

</div>

Trying to understand what LoopVectorization does/doesn’t like. If I broadcast-add elements of tuples function bcast\_add(x::NTuple{N,T},y::NTuple{N,T}) where {N,T} @avx for i = 1:length(first(x)) x\_i = getin…

---

## [Passing a C struct into Julia](https://discourse.julialang.org/t/passing-a-c-struct-into-julia/43965)

<div class="topic-metadata">

**Author:** [@Vangelis](https://discourse.julialang.org/u/Vangelis)\
**Replies:** 20\
**Last updated:** [February 2, 2021, 5:19pm UTC](https://discourse.julialang.org/t/passing-a-c-struct-into-julia/43965 "2021-02-02T17:19:54Z")

</div>

Dear experts, I am trying to find a way to pass a C struct into a Julia model. Please note that the C struct has at least one array. For example: on the C side: typedef struct { int\* the\_integers; int\* the\_inte…

---

## [Why is iterating over an Iterators.drop slower than iterating over the parent?](https://discourse.julialang.org/t/why-is-iterating-over-an-iterators-drop-slower-than-iterating-over-the-parent/54315)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 3\
**Last updated:** [February 2, 2021, 4:31pm UTC](https://discourse.julialang.org/t/why-is-iterating-over-an-iterators-drop-slower-than-iterating-over-the-parent/54315 "2021-02-02T16:31:21Z")

</div>

Two ways to compute the last element of an iterator itr are: foldl((\_, y) -\> y, itr) first(Iterators.drop(itr, length(itr) - 1)) however, the second seems much slower than the first. I wonder why this is the case? Fo…

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

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