# General Usage

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

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

**Page:** 937

---

## [What are the symbols in LOAD\_PATH?](https://discourse.julialang.org/t/what-are-the-symbols-in-load-path/15420)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 4\
**Last updated:** [September 24, 2018, 10:58am UTC](https://discourse.julialang.org/t/what-are-the-symbols-in-load-path/15420 "2018-09-24T10:58:48Z")

</div>

I’ve been searching the docs but I couldn’t find anything about how are the symbols in LOAD\_PATH expanded? I’m referring to @, @v#.# and @stdlib. Thanks

---

## [Alternatives to DataFrames.readtable?](https://discourse.julialang.org/t/alternatives-to-dataframes-readtable/15414)

<div class="topic-metadata">

**Author:** [@danielc](https://discourse.julialang.org/u/danielc)\
**Replies:** 2\
**Last updated:** [September 24, 2018, 5:43am UTC](https://discourse.julialang.org/t/alternatives-to-dataframes-readtable/15414 "2018-09-24T05:43:01Z")

</div>

I know that DataFrames.readtable is being depracated but the new CSV.read does not work for me. I have to read fixed-column width data, like this: Time (years) a e i peri …

---

## [Function uses huge memory](https://discourse.julialang.org/t/function-uses-huge-memory/15333)

<div class="topic-metadata">

**Author:** [@Ajaychat3](https://discourse.julialang.org/u/Ajaychat3)\
**Replies:** 11\
**Last updated:** [September 24, 2018, 5:13am UTC](https://discourse.julialang.org/t/function-uses-huge-memory/15333 "2018-09-24T05:13:21Z")

</div>

I can not figure out as to why the function given below uses huge memory allocations. function findpi(n::Int64)::Float64 inside = 0 x,y=0.0,0.0 for i in 1:n x, y = rand(2) …

---

## [Error in inner constructor of a tagged struct](https://discourse.julialang.org/t/error-in-inner-constructor-of-a-tagged-struct/15401)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 1\
**Last updated:** [September 24, 2018, 12:33am UTC](https://discourse.julialang.org/t/error-in-inner-constructor-of-a-tagged-struct/15401 "2018-09-24T00:33:33Z")

</div>

When I am trying to run code like this naturalvariables = ('T', 'P', 'V', 'S') struct NaturalVariable{tag} values::Matrix function NaturalVariable{tag}(values) where tag tag ∉ naturalvariables && throw(…

---

## [Struct with fixed array sizes](https://discourse.julialang.org/t/struct-with-fixed-array-sizes/15396)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 3\
**Last updated:** [September 23, 2018, 7:28pm UTC](https://discourse.julialang.org/t/struct-with-fixed-array-sizes/15396 "2018-09-23T19:28:18Z")

</div>

Thanks, that’s helpful! As a follow up (though let me know if I should move it to a separate question), I hope to create a mutable struct with fixed array sizes based on a dimension input parameter, N. The following MWE…

---

## [Error with Pkg with using statement in startup.jl](https://discourse.julialang.org/t/error-with-pkg-with-using-statement-in-startup-jl/13127)

<div class="topic-metadata">

**Author:** [@jebej](https://discourse.julialang.org/u/jebej)\
**Replies:** 7\
**Last updated:** [September 23, 2018, 7:20pm UTC](https://discourse.julialang.org/t/error-with-pkg-with-using-statement-in-startup-jl/13127 "2018-09-23T19:20:12Z")

</div>

I have a using statement in my startup.jl file (using OhMyREPL), and upon building packages, I get the following warnings Building LibCURL ─→ \`C:\\Users\\Jeremy\\.julia\\packages\\LibCURL\\yT2TD\\deps\\build.log\` ┌ Error: Err…

---

## [Error while trying to add IJulia package to Julia ](https://discourse.julialang.org/t/error-while-trying-to-add-ijulia-package-to-julia/15362)

<div class="topic-metadata">

**Author:** [@Jai\_Kiran\_Uthayan](https://discourse.julialang.org/u/Jai_Kiran_Uthayan)\
**Replies:** 4\
**Last updated:** [September 23, 2018, 5:52pm UTC](https://discourse.julialang.org/t/error-while-trying-to-add-ijulia-package-to-julia/15362 "2018-09-23T17:52:33Z")

</div>

Error executing Jupyter command ‘kernelspec’: \[Errno ‘jupyter-kernelspec’ not found\] 2 │ ImportError: DLL load failed: The specified module could not be found. ERROR: LoadError: failed process: Process('C:\\Users\\jaiki\\…

---

## [Help with performance tuning this dataframe aggregation](https://discourse.julialang.org/t/help-with-performance-tuning-this-dataframe-aggregation/15357)

<div class="topic-metadata">

**Author:** [@jonjilla](https://discourse.julialang.org/u/jonjilla)\
**Replies:** 10\
**Last updated:** [September 23, 2018, 5:11pm UTC](https://discourse.julialang.org/t/help-with-performance-tuning-this-dataframe-aggregation/15357 "2018-09-23T17:11:28Z")

</div>

I’ve been working on an application and have narrowed down the piece that appears to be taking the most time. in this following code, it’s generating dataframes d,e,f l = 10000 data = DataFrame(\[Int64, Int64, Int64, In…

---

## [Do any of the auto differentiation packages support specifying known derivatives by hand?](https://discourse.julialang.org/t/do-any-of-the-auto-differentiation-packages-support-specifying-known-derivatives-by-hand/15383)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 5\
**Last updated:** [September 23, 2018, 4:52pm UTC](https://discourse.julialang.org/t/do-any-of-the-auto-differentiation-packages-support-specifying-known-derivatives-by-hand/15383 "2018-09-23T16:52:35Z")

</div>

Some of the functions I’m trying to do AD over involve integrals, and rather than let the AD fight through my quadrature functions, I want to just use the fundamental theorem of calculus to tell the AD that, essentially, …

---

## [Pattern for activating the current project](https://discourse.julialang.org/t/pattern-for-activating-the-current-project/15379)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 2\
**Last updated:** [September 23, 2018, 1:09pm UTC](https://discourse.julialang.org/t/pattern-for-activating-the-current-project/15379 "2018-09-23T13:09:11Z")

</div>

Just wanted to make sure that I’m using the new Pkg API as intended: 1 - every time I develop a standalone app I create a folder. Then I start a REPL, go into pkg\> mode and activate . Then I add the dependencies to the …

---

## [First command is slow after loading Plots.jl](https://discourse.julialang.org/t/first-command-is-slow-after-loading-plots-jl/15375)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 1\
**Last updated:** [September 23, 2018, 1:05pm UTC](https://discourse.julialang.org/t/first-command-is-slow-after-loading-plots-jl/15375 "2018-09-23T13:05:33Z")

</div>

Hi all- I have noticed a long lag (approximately 3-5 seconds) for the first command after entering using Plots. The timing below is misleading because Julia continues to run after printing. julia\> using Plots julia\> …

---

## [Sum, mapreduce and broadcasted](https://discourse.julialang.org/t/sum-mapreduce-and-broadcasted/15300)

<div class="topic-metadata">

**Author:** [@improbable22](https://discourse.julialang.org/u/improbable22)\
**Replies:** 14\
**Last updated:** [September 23, 2018, 7:57am UTC](https://discourse.julialang.org/t/sum-mapreduce-and-broadcasted/15300 "2018-09-23T07:57:36Z")

</div>

I was trying to sum a broadcasted array without materialising it. Why is this slower? using BenchmarkTools v = rand(100); @btime sum($v .\* $v') ## 9.906 μs (2 allocations: 78.20 KiB) @btime mapreduce(identity, +, Bro…

---

## [Way to check if variable is of type Union?](https://discourse.julialang.org/t/way-to-check-if-variable-is-of-type-union/15351)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 3\
**Last updated:** [September 23, 2018, 1:16am UTC](https://discourse.julialang.org/t/way-to-check-if-variable-is-of-type-union/15351 "2018-09-23T01:16:56Z")

</div>

Pretty abstract question that I can’t really wrap my head around. What is a robust way of checking if something is a Union? For example, (from the docs) \> typeof(Union{Real,String}) Union \> typeof(Union{AbstractFloa…

---

## [Combined declaration of multiple variables of the same type?](https://discourse.julialang.org/t/combined-declaration-of-multiple-variables-of-the-same-type/15353)

<div class="topic-metadata">

**Author:** [@Seif\_Shebl](https://discourse.julialang.org/u/Seif_Shebl)\
**Replies:** 7\
**Last updated:** [September 23, 2018, 1:07am UTC](https://discourse.julialang.org/t/combined-declaration-of-multiple-variables-of-the-same-type/15353 "2018-09-23T01:07:57Z")

</div>

Is it possible to declare multiple variables of the same type in a C-style in Julia? I like to define a struct as this: struct Tbp es::Float64 ep::Float64 vsss::Float64 vsps::Float64 vpps::Float64 vppp::Floa…

---

## [What is the idiomatic way to undo a gensym?](https://discourse.julialang.org/t/what-is-the-idiomatic-way-to-undo-a-gensym/15354)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 3\
**Last updated:** [September 22, 2018, 8:11pm UTC](https://discourse.julialang.org/t/what-is-the-idiomatic-way-to-undo-a-gensym/15354 "2018-09-22T20:11:56Z")

</div>

I’ve never seen gensym before today, but is there an idiomatic way to undo the operation? For example, \> gensym("Core.println") Symbol("##Core.println#701") I guess one way would be to regex it: \> match(r"(?\<=##)\[^#\]…

---

## [Way to migrate jld2 data to have new fields without corruption?](https://discourse.julialang.org/t/way-to-migrate-jld2-data-to-have-new-fields-without-corruption/15309)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 3\
**Last updated:** [September 22, 2018, 8:01pm UTC](https://discourse.julialang.org/t/way-to-migrate-jld2-data-to-have-new-fields-without-corruption/15309 "2018-09-22T20:01:43Z")

</div>

Let’s say you have a struct, Foo: struct Foo fizz::Int end Then you make a slew of Foo’s and save them to a file using JLD2.jl Now, your boss tells you to add a buzz flag: struct Foo fizz::Int buzz::Bool end …

---

## [Functional style table processing](https://discourse.julialang.org/t/functional-style-table-processing/15336)

<div class="topic-metadata">

**Author:** [@Andrey.Borzunov](https://discourse.julialang.org/u/Andrey.Borzunov)\
**Replies:** 7\
**Last updated:** [September 22, 2018, 8:03pm UTC](https://discourse.julialang.org/t/functional-style-table-processing/15336 "2018-09-22T20:03:09Z")

</div>

I have an Array of Tuples: A = \[ (1,10); (1,20); (1,30); (2,15); (2,25); (2,35); (3,17); (3,27); (3,37); \] I want to get new Array of Tuples (x,y) where x is unique, and y = mean(z), where z is all elements from previo…

---

## [Writing 8-bit bytes](https://discourse.julialang.org/t/writing-8-bit-bytes/15334)

<div class="topic-metadata">

**Author:** [@David\_Feldman](https://discourse.julialang.org/u/David_Feldman)\
**Replies:** 5\
**Last updated:** [September 22, 2018, 7:55pm UTC](https://discourse.julialang.org/t/writing-8-bit-bytes/15334 "2018-09-22T19:55:54Z")

</div>

I wanted to create a certain file consisting of 8-bit bytes (to conform with a picture format). In the following, the value of Q was always in the range 0-255. But the command write(OUT, convert(UInt8,floor(Q))) actua…

---

## [Julia 1.0, tight-binding benchmark and array slices](https://discourse.julialang.org/t/julia-1-0-tight-binding-benchmark-and-array-slices/13943)

<div class="topic-metadata">

**Author:** [@jabl](https://discourse.julialang.org/u/jabl)\
**Replies:** 9\
**Last updated:** [September 22, 2018, 7:02pm UTC](https://discourse.julialang.org/t/julia-1-0-tight-binding-benchmark-and-array-slices/13943 "2018-09-22T19:02:37Z")

</div>

Hi, following the recent release of Julia 1.0 I updated a small benchmark tight-binding program that I have implemented in Fortran, C++ with Eigen, C++ with Armadillo, and python/numpy. Roughly, the Fortran and both C++…

---

## [Arrays of User Types](https://discourse.julialang.org/t/arrays-of-user-types/15348)

<div class="topic-metadata">

**Author:** [@Fanny](https://discourse.julialang.org/u/Fanny)\
**Replies:** 2\
**Last updated:** [September 22, 2018, 6:39pm UTC](https://discourse.julialang.org/t/arrays-of-user-types/15348 "2018-09-22T18:39:57Z")

</div>

Using Julia 1.0, I am creating a mutable struct XX with two Float64 fields, x and y. I then use AA = fill(XX(100.0,200.0),10) to create an Array of type XX. However, when i type AA\[1\].x = 300.0, it seems to change the …

---

## [Why does println break @generated functions?](https://discourse.julialang.org/t/why-does-println-break-generated-functions/15344)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 3\
**Last updated:** [September 22, 2018, 5:33pm UTC](https://discourse.julialang.org/t/why-does-println-break-generated-functions/15344 "2018-09-22T17:33:50Z")

</div>

I’m trying to debug JLD2, but can’t find the line that breaks. I think it’s somewhere in a @generated function, but adding println’s to it breaks everything. i.e. I get this error message: task switch not allowed from…

---

## [Does "while" start a new scope now?](https://discourse.julialang.org/t/does-while-start-a-new-scope-now/15341)

<div class="topic-metadata">

**Author:** [@NKC](https://discourse.julialang.org/u/NKC)\
**Replies:** 4\
**Last updated:** [September 22, 2018, 4:56pm UTC](https://discourse.julialang.org/t/does-while-start-a-new-scope-now/15341 "2018-09-22T16:56:04Z")

</div>

Hello, Does “while” start a new scope now? Below code was not working without global y definition? Am I wrong? function f3() y=0 while y\<5 y=y+1 print("f3: y=",y,"\\n") …

---

## [Is there a way to get the full definition of a function as String?](https://discourse.julialang.org/t/is-there-a-way-to-get-the-full-definition-of-a-function-as-string/15306)

<div class="topic-metadata">

**Author:** [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Replies:** 8\
**Last updated:** [September 22, 2018, 3:14pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-get-the-full-definition-of-a-function-as-string/15306 "2018-09-22T15:14:17Z")

</div>

Beside having to parse the script file.

---

## [Product of three matrices fast](https://discourse.julialang.org/t/product-of-three-matrices-fast/15339)

<div class="topic-metadata">

**Author:** [@jarl](https://discourse.julialang.org/u/jarl)\
**Replies:** 5\
**Last updated:** [September 22, 2018, 3:11pm UTC](https://discourse.julialang.org/t/product-of-three-matrices-fast/15339 "2018-09-22T15:11:09Z")

</div>

I want to multiply three matrices together as efficiently as possible. We all know that if you have tall and skinny or fat and short matrices, the order of operations when multiplying three matrices matter a lot for eff…

---

## [How to update PR to METADATA.jl?](https://discourse.julialang.org/t/how-to-update-pr-to-metadata-jl/1550)

<div class="topic-metadata">

**Author:** [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Replies:** 9\
**Last updated:** [September 22, 2018, 10:15am UTC](https://discourse.julialang.org/t/how-to-update-pr-to-metadata-jl/1550 "2018-09-22T10:15:29Z")

</div>

Scenario: Tag a new version of a package and run PkgDev.publish() to create a PR to METADATA.jl. Collect comments and do changes to your package. Add a new commit to your package. Update PR. Steps 1 to 3 are clear, bu…

---

## [How to get the julia executable from within Julia?](https://discourse.julialang.org/t/how-to-get-the-julia-executable-from-within-julia/15327)

<div class="topic-metadata">

**Author:** [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Replies:** 2\
**Last updated:** [September 22, 2018, 6:41am UTC](https://discourse.julialang.org/t/how-to-get-the-julia-executable-from-within-julia/15327 "2018-09-22T06:41:27Z")

</div>

Hi, how can I get the currently running Julia executable file path from within the Julia instance?

---

## [How to assign value in macro from a function call](https://discourse.julialang.org/t/how-to-assign-value-in-macro-from-a-function-call/15283)

<div class="topic-metadata">

**Author:** [@shipengcheng1230](https://discourse.julialang.org/u/shipengcheng1230)\
**Replies:** 3\
**Last updated:** [September 21, 2018, 10:52pm UTC](https://discourse.julialang.org/t/how-to-assign-value-in-macro-from-a-function-call/15283 "2018-09-21T22:52:53Z")

</div>

I tried to follow this example to build a macro that does such thing: x = f(args...): julia\> function mysum(args...) sum(\[x for x in args\]) end mysum (generic function with 1 method) julia\> ma…

---

## [What is easiest way to transform an array of objects into a data table?](https://discourse.julialang.org/t/what-is-easiest-way-to-transform-an-array-of-objects-into-a-data-table/15310)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 5\
**Last updated:** [September 22, 2018, 1:01am UTC](https://discourse.julialang.org/t/what-is-easiest-way-to-transform-an-array-of-objects-into-a-data-table/15310 "2018-09-22T01:01:39Z")

</div>

Let’s say you have a struct Foo, that has 30 or so named fields: struct Foo a::Int b::AbstractFloat ... y::Bool z::Int end Now you want to store it (without the use of JLD). What is the go-to method for…

---

## [Way to store dict of DataFrame tables in a single file?](https://discourse.julialang.org/t/way-to-store-dict-of-dataframe-tables-in-a-single-file/15318)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 2\
**Last updated:** [September 21, 2018, 9:42pm UTC](https://discourse.julialang.org/t/way-to-store-dict-of-dataframe-tables-in-a-single-file/15318 "2018-09-21T21:42:38Z")

</div>

From the DataFrame docs, they say the best way to store DataFrames is through a CSV: using DataFrames using CSV df = DataFrame(x = 1, y = 2) CSV.write(output, df) However, let’s say you want to have: a dictionary o…

---

## [Metaclass programming in Julia](https://discourse.julialang.org/t/metaclass-programming-in-julia/15315)

<div class="topic-metadata">

**Author:** [@Olof\_Salberger](https://discourse.julialang.org/u/Olof_Salberger)\
**Replies:** 0\
**Last updated:** [September 21, 2018, 8:15pm UTC](https://discourse.julialang.org/t/metaclass-programming-in-julia/15315 "2018-09-21T20:15:51Z")

</div>

Question: Since Julia types are objects with a singleton type that you can add any number of methods to, and the constructor is just the call operator implemented on that type, does that mean that metaclass programming a…

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

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