# General Usage

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

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

**Page:** 832

---

## [In-place functions with arrays and scalars](https://discourse.julialang.org/t/in-place-functions-with-arrays-and-scalars/28885)

<div class="topic-metadata">

**Author:** [@HenrikM](https://discourse.julialang.org/u/HenrikM)\
**Replies:** 7\
**Last updated:** [September 18, 2019, 12:27pm UTC](https://discourse.julialang.org/t/in-place-functions-with-arrays-and-scalars/28885 "2019-09-18T12:27:58Z")

</div>

For a function that returns scalars and arrays, what is good practice for the mutating version? Below, x and y are scalars and A and B are arrays. function f(...) x = ... y = ... A = ... B = ... return x, A, y…

---

## [How to get to know in which subfunction a macro is called?](https://discourse.julialang.org/t/how-to-get-to-know-in-which-subfunction-a-macro-is-called/28877)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 3\
**Last updated:** [September 18, 2019, 10:31am UTC](https://discourse.julialang.org/t/how-to-get-to-know-in-which-subfunction-a-macro-is-called/28877 "2019-09-18T10:31:14Z")

</div>

Hi there, using macros we have access to the special variables \_\_modules\_\_ which gives me the current module, and \_\_source\_\_ which gives linenumber and file. Neither of them can tell me in which subfunction the code is…

---

## [Quote with a list of kwargs](https://discourse.julialang.org/t/quote-with-a-list-of-kwargs/28879)

<div class="topic-metadata">

**Author:** [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Replies:** 3\
**Last updated:** [September 18, 2019, 10:19am UTC](https://discourse.julialang.org/t/quote-with-a-list-of-kwargs/28879 "2019-09-18T10:19:26Z")

</div>

The following code is a MWE of what I’m trying to do; I’d like to write the inside of the foo function as a quote if possible (in order to make the code in my use case more readable and maintainable). function foo(fname…

---

## [Appropriate Structures for Reusing Code](https://discourse.julialang.org/t/appropriate-structures-for-reusing-code/28871)

<div class="topic-metadata">

**Author:** [@anodos](https://discourse.julialang.org/u/anodos)\
**Replies:** 4\
**Last updated:** [September 18, 2019, 5:08am UTC](https://discourse.julialang.org/t/appropriate-structures-for-reusing-code/28871 "2019-09-18T05:08:34Z")

</div>

I’ve recently been forced to relearn python for a work application. Needless to say, after working with Julia for a while, there were plenty of things I found a little painful (vectorisation, the need to use numba/cython…

---

## [What exactly does @spawnat capture?](https://discourse.julialang.org/t/what-exactly-does-spawnat-capture/28865)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 0\
**Last updated:** [September 17, 2019, 8:46pm UTC](https://discourse.julialang.org/t/what-exactly-does-spawnat-capture/28865 "2019-09-17T20:46:48Z")

</div>

From the documents, I get the impression that the following statement @spawnat 2 f(a, b) will run if f is defined on the remote processes. @spawnat will capture the variable a and b automatically. However, this functio…

---

## [Call macro created function/types from generated function. world age problem](https://discourse.julialang.org/t/call-macro-created-function-types-from-generated-function-world-age-problem/28859)

<div class="topic-metadata">

**Author:** [@Orbots](https://discourse.julialang.org/u/Orbots)\
**Replies:** 2\
**Last updated:** [September 17, 2019, 8:19pm UTC](https://discourse.julialang.org/t/call-macro-created-function-types-from-generated-function-world-age-problem/28859 "2019-09-17T20:19:36Z")

</div>

I want to allow a user of my module to generate some types and functions via a macro which are then supported by generated functions. For reasons, I am able to deduce constant scalar numbers from type information for a …

---

## [Dictating Julia code (for those who wish to avoid or control RSI)](https://discourse.julialang.org/t/dictating-julia-code-for-those-who-wish-to-avoid-or-control-rsi/14062)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 7\
**Last updated:** [September 17, 2019, 4:11pm UTC](https://discourse.julialang.org/t/dictating-julia-code-for-those-who-wish-to-avoid-or-control-rsi/14062 "2019-09-17T16:11:20Z")

</div>

A while back someone asked me about my approach to working with a code while avoiding typing and mousing by hand. I promised a video illustrating the basics. Since it may be of more general use, here it is: Dropbox - Fil…

---

## [Ways to speed up this code](https://discourse.julialang.org/t/ways-to-speed-up-this-code/28841)

<div class="topic-metadata">

**Author:** [@IljaK91](https://discourse.julialang.org/u/IljaK91)\
**Replies:** 4\
**Last updated:** [September 17, 2019, 3:57pm UTC](https://discourse.julialang.org/t/ways-to-speed-up-this-code/28841 "2019-09-17T15:57:55Z")

</div>

Hey everybody, I want to run this code on a relatively large dataset consisting of daily firm-level, industry-level and market-level data. This code takes long to run, because I run a simple regression for every firm-mo…

---

## [Storing Graphs](https://discourse.julialang.org/t/storing-graphs/28838)

<div class="topic-metadata">

**Author:** [@ennvvy](https://discourse.julialang.org/u/ennvvy)\
**Replies:** 1\
**Last updated:** [September 17, 2019, 2:20pm UTC](https://discourse.julialang.org/t/storing-graphs/28838 "2019-09-17T14:20:44Z")

</div>

I use the following commands to generate small-world networks; using LightGraphs g = SimpleDiGraph{Int64} ; g = watts\_strogatz(100,24,0.5,is\_directed=true) ; I would like to generate 100 different small-world n…

---

## [Julia 0.7: Package BinDeps not found in current path](https://discourse.julialang.org/t/julia-0-7-package-bindeps-not-found-in-current-path/13400)

<div class="topic-metadata">

**Author:** [@dpo](https://discourse.julialang.org/u/dpo)\
**Replies:** 5\
**Last updated:** [September 17, 2019, 12:16pm UTC](https://discourse.julialang.org/t/julia-0-7-package-bindeps-not-found-in-current-path/13400 "2019-09-17T12:16:57Z")

</div>

I’m trying to use BinDeps in AMD.jl with Julia 0.7 stable. The package looks for libamd, which ships with Julia but isn’t versioned. I wrote the simplest build.jl: using BinDeps @BinDeps.setup libamd = library\_dependenc…

---

## [Set file properties to readonly (Windows)](https://discourse.julialang.org/t/set-file-properties-to-readonly-windows/28839)

<div class="topic-metadata">

**Author:** [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Replies:** 1\
**Last updated:** [September 17, 2019, 12:09pm UTC](https://discourse.julialang.org/t/set-file-properties-to-readonly-windows/28839 "2019-09-17T12:09:44Z")

</div>

Is it possible to set a file to readonly with a julia command/script? I am using Windows.

---

## [Implementation for matrix multiplication with \`adjoint\`](https://discourse.julialang.org/t/implementation-for-matrix-multiplication-with-adjoint/28828)

<div class="topic-metadata">

**Author:** [@tomohiro\_soejima](https://discourse.julialang.org/u/tomohiro_soejima)\
**Replies:** 4\
**Last updated:** [September 17, 2019, 1:54am UTC](https://discourse.julialang.org/t/implementation-for-matrix-multiplication-with-adjoint/28828 "2019-09-17T01:54:11Z")

</div>

Hi, As I understand it, adjoint creates a lazy wrapper for an adjoint of an array, and therefore does not create a copy. I’m wondering how multiplication is implemented in this case i.e. what kind of LAPACK functionalit…

---

## [When to use sizehint! for Dict?](https://discourse.julialang.org/t/when-to-use-sizehint-for-dict/28833)

<div class="topic-metadata">

**Author:** [@milesf](https://discourse.julialang.org/u/milesf)\
**Replies:** 0\
**Last updated:** [September 16, 2019, 11:17pm UTC](https://discourse.julialang.org/t/when-to-use-sizehint-for-dict/28833 "2019-09-16T23:17:01Z")

</div>

Benchmarking shows that using sizehint! to match the expected number of Dict elements is best in almost all cases, except when the number of elements is at or near 10^5. Both 10^4 and 10^6 prefer sizehint!, but 10^5 stra…

---

## [How to modify nprocs with DistributedArrays inside a function](https://discourse.julialang.org/t/how-to-modify-nprocs-with-distributedarrays-inside-a-function/28796)

<div class="topic-metadata">

**Author:** [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Replies:** 2\
**Last updated:** [September 16, 2019, 7:44pm UTC](https://discourse.julialang.org/t/how-to-modify-nprocs-with-distributedarrays-inside-a-function/28796 "2019-09-16T19:44:16Z")

</div>

Hi, I want to draw speed-up plots with Distributed and DistributedArrays. I use Distributed.addprocs inside my benchmark function but I should also use @everywhere using DistributedArrays that cannot (true ?) be calle…

---

## [How to make Julia slow?](https://discourse.julialang.org/t/how-to-make-julia-slow/28742)

<div class="topic-metadata">

**Author:** [@Carol](https://discourse.julialang.org/u/Carol)\
**Replies:** 11\
**Last updated:** [September 16, 2019, 6:55pm UTC](https://discourse.julialang.org/t/how-to-make-julia-slow/28742 "2019-09-16T18:55:09Z")

</div>

Hi, I want to test the speed of dot product dot()(speeded up by Julia) V.S. dot product without any parallel. I want to see how fast does Julia speed up the dot product. For non-parallel dot product, I write a for-loop…

---

## [Missing matrix-by-sparse-matrix multiplication specializations?](https://discourse.julialang.org/t/missing-matrix-by-sparse-matrix-multiplication-specializations/28816)

<div class="topic-metadata">

**Author:** [@dgleich](https://discourse.julialang.org/u/dgleich)\
**Replies:** 2\
**Last updated:** [September 16, 2019, 5:26pm UTC](https://discourse.julialang.org/t/missing-matrix-by-sparse-matrix-multiplication-specializations/28816 "2019-09-16T17:26:48Z")

</div>

It looks like the sparse matrix \* array specializations are missing a simple-to-add case: A = sparse (n-by-n, say) X = wide (k-by-n) Y = wide (k-by-n) Y = X\*A or mul!(Y,X,A) seems to fall back to the generic case. I…

---

## [Flux.jl, treat rows independently](https://discourse.julialang.org/t/flux-jl-treat-rows-independently/28822)

<div class="topic-metadata">

**Author:** [@modedec](https://discourse.julialang.org/u/modedec)\
**Replies:** 0\
**Last updated:** [September 16, 2019, 5:08pm UTC](https://discourse.julialang.org/t/flux-jl-treat-rows-independently/28822 "2019-09-16T17:08:01Z")

</div>

I would like to train on the rows feature independently. Therefore, I would like to have a dense layer for row 1, row 2 …, row n and at the end combine the 12 row outputs. Is it possible in Flux.jl. At the end I would li…

---

## [macOS homebrew SHA-256 checksum error](https://discourse.julialang.org/t/macos-homebrew-sha-256-checksum-error/28785)

<div class="topic-metadata">

**Author:** [@tamasgal](https://discourse.julialang.org/u/tamasgal)\
**Replies:** 3\
**Last updated:** [September 16, 2019, 3:34pm UTC](https://discourse.julialang.org/t/macos-homebrew-sha-256-checksum-error/28785 "2019-09-16T15:34:14Z")

</div>

According to https://github.com/JuliaLang/julia/issues/31465 I should report such issues on discourse, so here we are… I am not able to install Julia 1.2.0 on a freshly installed latest macOS Mojave (10.14.6) with a shi…

---

## [Coverage of semantic versioning for package APIs?](https://discourse.julialang.org/t/coverage-of-semantic-versioning-for-package-apis/28808)

<div class="topic-metadata">

**Author:** [@oschulz](https://discourse.julialang.org/u/oschulz)\
**Replies:** 4\
**Last updated:** [September 16, 2019, 1:58pm UTC](https://discourse.julialang.org/t/coverage-of-semantic-versioning-for-package-apis/28808 "2019-09-16T13:58:40Z")

</div>

Sorry in case this has been asked before: What part of a Julia package API is supposed to by covered by semantic versioning conventions? Everything exported? Everything documented, whether exported or not (unless labeled…

---

## [Pkg problem with Julia 1.1](https://discourse.julialang.org/t/pkg-problem-with-julia-1-1/28787)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 9\
**Last updated:** [September 16, 2019, 7:56am UTC](https://discourse.julialang.org/t/pkg-problem-with-julia-1-1/28787 "2019-09-16T07:56:20Z")

</div>

I’m testing an updated package developed by a collaborator. The updated package doesn’t install; instead, the old package (which I have renamed on my computer) gets installed. I use Julia v. 1.1 on Windows 10, 64 bit, la…

---

## [Specify type when calling parametric function](https://discourse.julialang.org/t/specify-type-when-calling-parametric-function/28805)

<div class="topic-metadata">

**Author:** [@aahaselgrove](https://discourse.julialang.org/u/aahaselgrove)\
**Replies:** 6\
**Last updated:** [September 16, 2019, 7:33am UTC](https://discourse.julialang.org/t/specify-type-when-calling-parametric-function/28805 "2019-09-16T07:33:33Z")

</div>

Say I have a parametric function: foo(a::Union{T, Vector{T}}) where {T} = T Calling foo(ones(1)) returns Float64, implying that Julia has decided that a was of type Vector{T}. Is it possible to call this function expli…

---

## [How can I preview the weave code?](https://discourse.julialang.org/t/how-can-i-preview-the-weave-code/28765)

<div class="topic-metadata">

**Author:** [@alexandre47](https://discourse.julialang.org/u/alexandre47)\
**Replies:** 7\
**Last updated:** [September 16, 2019, 7:26am UTC](https://discourse.julialang.org/t/how-can-i-preview-the-weave-code/28765 "2019-09-16T07:26:34Z")

</div>

Hi! I started learning weave, for create Documentation using Julia. I can not see the preview in the Atom editor (I have the language-weave installed, and Julia too). Is there another way to see the preview, maybe ano…

---

## [Split 2d array into array of 1d arrays](https://discourse.julialang.org/t/split-2d-array-into-array-of-1d-arrays/28803)

<div class="topic-metadata">

**Author:** [@aahaselgrove](https://discourse.julialang.org/u/aahaselgrove)\
**Replies:** 5\
**Last updated:** [September 16, 2019, 6:51am UTC](https://discourse.julialang.org/t/split-2d-array-into-array-of-1d-arrays/28803 "2019-09-16T06:51:33Z")

</div>

If you have an array of arrays, you can join them into a 2d array as follows: a = fill(ones(10), 10) A = hcat(a...) How can you do the reverse?

---

## [Eval a CodeInfo object?](https://discourse.julialang.org/t/eval-a-codeinfo-object/18076)

<div class="topic-metadata">

**Author:** [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Replies:** 5\
**Last updated:** [September 16, 2019, 3:18am UTC](https://discourse.julialang.org/t/eval-a-codeinfo-object/18076 "2019-09-16T03:18:59Z")

</div>

Digging through the Julia AST docs I’ve got curious how far we can go with the lowered code representation. In particular: Can we evaluate CodeInfo object as a whole? Can we evaluate each its expression (in .code field…

---

## [How to update an array efficiently](https://discourse.julialang.org/t/how-to-update-an-array-efficiently/28727)

<div class="topic-metadata">

**Author:** [@linwaytin](https://discourse.julialang.org/u/linwaytin)\
**Replies:** 14\
**Last updated:** [September 15, 2019, 8:30pm UTC](https://discourse.julialang.org/t/how-to-update-an-array-efficiently/28727 "2019-09-15T20:30:53Z")

</div>

Hello, I found I use statements like this a lot: A = func(A) with func a function returning a array of the same size. Is this efficient? Or there is a better way to write this kind of things? Thanks.

---

## [Modules, macros and global variables](https://discourse.julialang.org/t/modules-macros-and-global-variables/28754)

<div class="topic-metadata">

**Author:** [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Replies:** 9\
**Last updated:** [September 15, 2019, 7:59pm UTC](https://discourse.julialang.org/t/modules-macros-and-global-variables/28754 "2019-09-15T19:59:55Z")

</div>

Let’s say, I have: Module A with global variable RULES, macro @add\_rule and function apply\_all\_rules(). Module B which defines some rules using A.@add\_rule thus pushing them to A.RULES. Module C in which we simply impo…

---

## [Functions that modify recipe (RecipesBase)](https://discourse.julialang.org/t/functions-that-modify-recipe-recipesbase/28788)

<div class="topic-metadata">

**Author:** [@anon92994695](https://discourse.julialang.org/u/anon92994695)\
**Replies:** 1\
**Last updated:** [September 15, 2019, 2:50pm UTC](https://discourse.julialang.org/t/functions-that-modify-recipe-recipesbase/28788 "2019-09-15T14:50:41Z")

</div>

I’m trying to do something seemingly simple with RecipesBase thats turning out to be a bit of a headache. Is there a pragmatic way to make a function that returns a call from an @recipe plot function? Here is a toy prom…

---

## [Error during bootstrap while building Julia 1.2 on macOS Mojave](https://discourse.julialang.org/t/error-during-bootstrap-while-building-julia-1-2-on-macos-mojave/28781)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 0\
**Last updated:** [September 15, 2019, 3:39am UTC](https://discourse.julialang.org/t/error-during-bootstrap-while-building-julia-1-2-on-macos-mojave/28781 "2019-09-15T03:39:00Z")

</div>

While building Julia 1.2 on macOS Mojave, I get an error during bootstrap: $ git checkout release-1.2 Already on 'release-1.2' Your branch is up to date with 'origin/release-1.2'. $ make ... error during bootstrap: Load…

---

## [How to check which package is preventing updates](https://discourse.julialang.org/t/how-to-check-which-package-is-preventing-updates/28771)

<div class="topic-metadata">

**Author:** [@Egwene\_al\_Vere](https://discourse.julialang.org/u/Egwene_al_Vere)\
**Replies:** 1\
**Last updated:** [September 14, 2019, 11:37pm UTC](https://discourse.julialang.org/t/how-to-check-which-package-is-preventing-updates/28771 "2019-09-14T23:37:12Z")

</div>

Is there a way to check which package is preventing the updates for other packages? The old discussion here uses REQUIRE which is no longer applies since now julia has switched to toml. Does Pkg have a FWIW, some packag…

---

## [Does Pkg.test() return anything useful?](https://discourse.julialang.org/t/does-pkg-test-return-anything-useful/28761)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 1\
**Last updated:** [September 14, 2019, 8:32pm UTC](https://discourse.julialang.org/t/does-pkg-test-return-anything-useful/28761 "2019-09-14T20:32:37Z")

</div>

It seems to me that Pkg.test() returns nothing. Is there a way in which I could find out programmatically if the tests passed?

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

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