# General Usage

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

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

**Page:** 1027

---

## [Parametric Type Constructor](https://discourse.julialang.org/t/parametric-type-constructor/5930)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 1\
**Last updated:** [September 17, 2017, 10:47am UTC](https://discourse.julialang.org/t/parametric-type-constructor/5930 "2017-09-17T10:47:10Z")

</div>

Hi Everyone, Think of a parametric constructor like this type Node{T}\<:Tree{T} value::T parent::Tree{T} children::Vector{Tree{T}} end And I want to do this : Node(12) just initializing…

---

## [Why Matrix{Float64}() is deprecated but Vector{Float64}() isn't?](https://discourse.julialang.org/t/why-matrix-float64-is-deprecated-but-vector-float64-isnt/5923)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 3\
**Last updated:** [September 17, 2017, 6:36am UTC](https://discourse.julialang.org/t/why-matrix-float64-is-deprecated-but-vector-float64-isnt/5923 "2017-09-17T06:36:40Z")

</div>

Matrix{Float64}() generates a deprecation warning in Julia 0.6.0: WARNING: Matrix{T}() is deprecated, use Matrix{T}(0, 0) instead. But Vector{Float64}() works fine. Why one is deprecated but the other isn’t? What is …

---

## [Profiling compilation time](https://discourse.julialang.org/t/profiling-compilation-time/5849)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 9\
**Last updated:** [September 17, 2017, 3:57am UTC](https://discourse.julialang.org/t/profiling-compilation-time/5849 "2017-09-17T03:57:56Z")

</div>

My code is heavy on parametric types, and rather slow to compile. I would like to know on which functions that time is being spent. Is there a tool to report on that? Barring that, is there a way to force compilation of…

---

## [Performance of functions with keyword arguments](https://discourse.julialang.org/t/performance-of-functions-with-keyword-arguments/5916)

<div class="topic-metadata">

**Author:** [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Replies:** 6\
**Last updated:** [September 16, 2017, 5:54pm UTC](https://discourse.julialang.org/t/performance-of-functions-with-keyword-arguments/5916 "2017-09-16T17:54:37Z")

</div>

In the manual, we read: Functions with keyword arguments have near-zero overhead for call sites that pass only positional arguments. Does this mean that functions with keyword arguments are as fast as functions witho…

---

## [Dict Expression Problem](https://discourse.julialang.org/t/dict-expression-problem/5921)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 4\
**Last updated:** [September 16, 2017, 3:54pm UTC](https://discourse.julialang.org/t/dict-expression-problem/5921 "2017-09-16T15:54:07Z")

</div>

Hi, I am getting the following error: julia\> ex =Expr(:call,:Dict{Symbol,Tuple{Function,Function}},(:x =\> (()-\>begin x end, x330-\> begin x= x330 end))) ERROR: TypeError: Type{...} expression: expected Type{T}, got Symb…

---

## [Log1p in Base vs Base.Math.JuliaLibm](https://discourse.julialang.org/t/log1p-in-base-vs-base-math-julialibm/5852)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 8\
**Last updated:** [September 16, 2017, 2:52am UTC](https://discourse.julialang.org/t/log1p-in-base-vs-base-math-julialibm/5852 "2017-09-16T02:52:47Z")

</div>

?log1p says that There is an experimental variant in the Base.Math.JuliaLibm module, which is typically faster and more accurate. So why isn’t that one used in Base — does it have some problems? What should one know …

---

## [How to use multiple levels of module?](https://discourse.julialang.org/t/how-to-use-multiple-levels-of-module/5899)

<div class="topic-metadata">

**Author:** [@jwu](https://discourse.julialang.org/u/jwu)\
**Replies:** 5\
**Last updated:** [September 15, 2017, 5:04pm UTC](https://discourse.julialang.org/t/how-to-use-multiple-levels-of-module/5899 "2017-09-15T17:04:11Z")

</div>

suppose that we have a module hierarchy of Foo.Bar.XX, and Foo.YY in the XX module, how can I use YY module? I tried these two, do not work using …/…YY using …YY

---

## [How to find index in String Array](https://discourse.julialang.org/t/how-to-find-index-in-string-array/5901)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 3\
**Last updated:** [September 15, 2017, 11:14am UTC](https://discourse.julialang.org/t/how-to-find-index-in-string-array/5901 "2017-09-15T11:14:09Z")

</div>

How to find index in String Array Version 0.5.0 (2016-09-19 18:14 UTC) Official http://julialang.org/ release x86\_64-w64-mingw32 julia\> userstemp 5-element Array{String,1}: “aa” “ab” “ac” “ad” “zz” julia\> inde…

---

## ["running in world age X, while current world is Y" errors](https://discourse.julialang.org/t/running-in-world-age-x-while-current-world-is-y-errors/5871)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 5\
**Last updated:** [September 15, 2017, 7:56am UTC](https://discourse.julialang.org/t/running-in-world-age-x-while-current-world-is-y-errors/5871 "2017-09-15T07:56:23Z")

</div>

Sorry if I’m missing something obvious but I don’t quite understand why I suddenly get all these errors in v0.6 in all cases where I was successfully dynamically invoking functions before. I did some searching and I dis…

---

## [Type-level variables, i.e. static parameters?](https://discourse.julialang.org/t/type-level-variables-i-e-static-parameters/5893)

<div class="topic-metadata">

**Author:** [@tlnagy](https://discourse.julialang.org/u/tlnagy)\
**Replies:** 2\
**Last updated:** [September 15, 2017, 6:30am UTC](https://discourse.julialang.org/t/type-level-variables-i-e-static-parameters/5893 "2017-09-15T06:30:31Z")

</div>

I’m writing a parser that has to keep track of many different open files so I have a File type that contains all the relevant information inside of it. Is there any way to do this on instantiation? Say something like thi…

---

## [How to print field names and values in a struct?](https://discourse.julialang.org/t/how-to-print-field-names-and-values-in-a-struct/5892)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 1\
**Last updated:** [September 14, 2017, 6:55pm UTC](https://discourse.julialang.org/t/how-to-print-field-names-and-values-in-a-struct/5892 "2017-09-14T18:55:53Z")

</div>

How to access the values of a and b in the code below? struct Foo a b end foo = Foo(1,2) function Base.show(io::IO, ::MIME"text/plain", foo::Foo) for fname in fieldnames(foo) println(io, "$fname = …

---

## [Design: memoizing functions with composite type arguments](https://discourse.julialang.org/t/design-memoizing-functions-with-composite-type-arguments/5887)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 3\
**Last updated:** [September 14, 2017, 5:19pm UTC](https://discourse.julialang.org/t/design-memoizing-functions-with-composite-type-arguments/5887 "2017-09-14T17:19:29Z")

</div>

Hi, I have been troubled by a specific design problem for a few days. The problem is as follows: I have a function f struct foo data::Matrix{Float64} end function f(x::foo) ... end Since f is fairly expensive, …

---

## [Idea: concrete interfaces](https://discourse.julialang.org/t/idea-concrete-interfaces/5885)

<div class="topic-metadata">

**Author:** [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Replies:** 4\
**Last updated:** [September 14, 2017, 4:44pm UTC](https://discourse.julialang.org/t/idea-concrete-interfaces/5885 "2017-09-14T16:44:30Z")

</div>

While I’m generally extremely happy with Julia’s type system, I have sometimes found myself wishing it were easier to efficiently deal with heterogeneous collections. For example, if I have a Vector of elements of differ…

---

## [Observables versus Reactive](https://discourse.julialang.org/t/observables-versus-reactive/5854)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 11\
**Last updated:** [September 14, 2017, 3:40pm UTC](https://discourse.julialang.org/t/observables-versus-reactive/5854 "2017-09-14T15:40:44Z")

</div>

Checkout Observables.jl, looks cool and super useful. I don’t think I really understand the difference between and Observable and a Reactive.Signal. Anyone here can explain? When would one be better than the other? Why?…

---

## [Macros and modules](https://discourse.julialang.org/t/macros-and-modules/5859)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 5\
**Last updated:** [September 14, 2017, 3:08pm UTC](https://discourse.julialang.org/t/macros-and-modules/5859 "2017-09-14T15:08:22Z")

</div>

Suppose I have a base package with abstract types and interfaces called BasePackage, and a second package with developer tools that builds on top of the base package called DevTools. In the latter package, I define helpe…

---

## [Packages to calculate seats allocation from votes?](https://discourse.julialang.org/t/packages-to-calculate-seats-allocation-from-votes/5873)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 4\
**Last updated:** [September 14, 2017, 1:50pm UTC](https://discourse.julialang.org/t/packages-to-calculate-seats-allocation-from-votes/5873 "2017-09-14T13:50:36Z")

</div>

Hello Is there any package to calculate how seats are distributed among the different parties given the number of votes in different regions of a country or to perform any kind of calculations or graphics with data coll…

---

## ["where" syntax](https://discourse.julialang.org/t/where-syntax/5876)

<div class="topic-metadata">

**Author:** [@John\_Gibson](https://discourse.julialang.org/u/John_Gibson)\
**Replies:** 9\
**Last updated:** [September 14, 2017, 10:55am UTC](https://discourse.julialang.org/t/where-syntax/5876 "2017-09-14T10:55:35Z")

</div>

I’m trying to update the following code (taken from an Andreas Noack talk) from to julia-0.5 to julia-0.6. The GF{P,T} type represents a finite Galois field, essentially the integers modulo P where P is prime. # Scalar …

---

## [Can we override "="?](https://discourse.julialang.org/t/can-we-override/5856)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 11\
**Last updated:** [September 13, 2017, 7:36pm UTC](https://discourse.julialang.org/t/can-we-override/5856 "2017-09-13T19:36:29Z")

</div>

Topic says it all. If so how? Thanks

---

## [Smart parsing .jmd files (Weave.jl)](https://discourse.julialang.org/t/smart-parsing-jmd-files-weave-jl/1877)

<div class="topic-metadata">

**Author:** [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Replies:** 7\
**Last updated:** [September 13, 2017, 6:31pm UTC](https://discourse.julialang.org/t/smart-parsing-jmd-files-weave-jl/1877 "2017-09-13T18:31:53Z")

</div>

I recently discovered Weave.jl, and it’s quickly become my go-to method for incorporating code/commentary. This is important for me since I’m using julia for scientific analysis and reproducibility is essential, and is p…

---

## [Official ARM-64 binaries for Julia v0.6?](https://discourse.julialang.org/t/official-arm-64-binaries-for-julia-v0-6/5867)

<div class="topic-metadata">

**Author:** [@oschulz](https://discourse.julialang.org/u/oschulz)\
**Replies:** 2\
**Last updated:** [September 13, 2017, 2:10pm UTC](https://discourse.julialang.org/t/official-arm-64-binaries-for-julia-v0-6/5867 "2017-09-13T14:10:16Z")

</div>

I was looking for Julia v0.6 binaries for 64-bit ARM (armv8-a). There are nightly builds, but there doesn’t seem to be a v0.6 release (only for ARMv7 32-bit). Does Julia 0.6 build on armv8-a, or would it be better to go …

---

## [Package getting large - can it be made smaller?](https://discourse.julialang.org/t/package-getting-large-can-it-be-made-smaller/5866)

<div class="topic-metadata">

**Author:** [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Replies:** 3\
**Last updated:** [September 13, 2017, 11:19am UTC](https://discourse.julialang.org/t/package-getting-large-can-it-be-made-smaller/5866 "2017-09-13T11:19:20Z")

</div>

Looking at the disk space used by one of my packages, it looks like nearly ⅔ is taken up with .git stuff: $ du ... 297400 ./.git 190584 ./docs 448 ./src 600 ./test ... Although it’s not a problem for me (and “We all …

---

## [Sort on tuple is \> 4x as fast as sortrows on the equivalent array](https://discourse.julialang.org/t/sort-on-tuple-is-4x-as-fast-as-sortrows-on-the-equivalent-array/5861)

<div class="topic-metadata">

**Author:** [@anon94023334](https://discourse.julialang.org/u/anon94023334)\
**Replies:** 2\
**Last updated:** [September 13, 2017, 7:07am UTC](https://discourse.julialang.org/t/sort-on-tuple-is-4x-as-fast-as-sortrows-on-the-equivalent-array/5861 "2017-09-13T07:07:58Z")

</div>

I was a little surprised at the performance difference here: julia\> shuffle!(a) 9-element Array{Tuple{Int64,Int64},1}: (1, 2) (2, 20) (2, 30) (2, 10) (3, 39) (1, 6) (1, 4) (3, 31) (3, 33) julia\> s = \[i\[1\] for …

---

## [Package compilation woes](https://discourse.julialang.org/t/package-compilation-woes/5658)

<div class="topic-metadata">

**Author:** [@quinnj](https://discourse.julialang.org/u/quinnj)\
**Replies:** 9\
**Last updated:** [September 13, 2017, 12:00am UTC](https://discourse.julialang.org/t/package-compilation-woes/5658 "2017-09-13T00:00:00Z")

</div>

Here’s the situation: I have the HTTP.jl package, which includes a decent amount of fairly modular code Without any tricks, package compilation takes 7 seconds, using takes 0.7 s, and making a first request takes 5 who…

---

## [Defining a solver type with macros](https://discourse.julialang.org/t/defining-a-solver-type-with-macros/5813)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 20\
**Last updated:** [September 12, 2017, 8:40pm UTC](https://discourse.julialang.org/t/defining-a-solver-type-with-macros/5813 "2017-09-12T20:40:18Z")

</div>

I am trying to write a macro that defines a solver type with a set of parameters. The idea is to write something like the following: @simsolver MySolver begin @param a = 1.0 @param b = false @param c end and get: …

---

## [Reading Fixed-Width Column Data](https://discourse.julialang.org/t/reading-fixed-width-column-data/4020)

<div class="topic-metadata">

**Author:** [@wibble](https://discourse.julialang.org/u/wibble)\
**Replies:** 6\
**Last updated:** [September 11, 2017, 2:03pm UTC](https://discourse.julialang.org/t/reading-fixed-width-column-data/4020 "2017-09-11T14:03:13Z")

</div>

Hi All, I’m trying to read in a file with rows that look like 13 MEXICO 130971 14 INDONESIA 126582 15 UNITED KINGDO…

---

## [Metaprogramming/code generation inside a function](https://discourse.julialang.org/t/metaprogramming-code-generation-inside-a-function/5821)

<div class="topic-metadata">

**Author:** [@louisponet](https://discourse.julialang.org/u/louisponet)\
**Replies:** 10\
**Last updated:** [September 11, 2017, 1:49pm UTC](https://discourse.julialang.org/t/metaprogramming-code-generation-inside-a-function/5821 "2017-09-11T13:49:24Z")

</div>

Hi, First I’ll quickly sketch the goal: I’ve been trying to read an input file which has a couple of blocks (control,system,electrons,ions,cell). Each block starts with a & and ends with a /. Inside each block there ar…

---

## [Accessing type of a resulting expression at compile time?](https://discourse.julialang.org/t/accessing-type-of-a-resulting-expression-at-compile-time/5818)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 2\
**Last updated:** [September 11, 2017, 11:54am UTC](https://discourse.julialang.org/t/accessing-type-of-a-resulting-expression-at-compile-time/5818 "2017-09-11T11:54:15Z")

</div>

Hi, I would like to access the type of an expression while writing macros? Is this doable? Ex: @tss function fun(x::Int,y::Float64) if x \> 4 y+1 else y-1 end end macro tss(func) #H…

---

## [Seemingly simple error](https://discourse.julialang.org/t/seemingly-simple-error/5816)

<div class="topic-metadata">

**Author:** [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Replies:** 5\
**Last updated:** [September 11, 2017, 9:38am UTC](https://discourse.julialang.org/t/seemingly-simple-error/5816 "2017-09-11T09:38:07Z")

</div>

I was trying to borrow some sparse QR functionality from base/sparse and base/linalg of the nightly version in v0.6. So I took base/linalg/qr.jl which is a dependency of the QR functions of base/sparse, renamed it to my\_…

---

## [Calling a function at a given time?](https://discourse.julialang.org/t/calling-a-function-at-a-given-time/5797)

<div class="topic-metadata">

**Author:** [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Replies:** 13\
**Last updated:** [September 11, 2017, 7:48am UTC](https://discourse.julialang.org/t/calling-a-function-at-a-given-time/5797 "2017-09-11T07:48:57Z")

</div>

Is there a way to do this in Julia that does not poll excessively? I know when the next transition to/from (local) standard time to savings time will occur. At that time, I would like to adjust the content of const offs…

---

## [Error building system image on Windows](https://discourse.julialang.org/t/error-building-system-image-on-windows/5815)

<div class="topic-metadata">

**Author:** [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Replies:** 0\
**Last updated:** [September 11, 2017, 1:54am UTC](https://discourse.julialang.org/t/error-building-system-image-on-windows/5815 "2017-09-11T01:54:47Z")

</div>

I’m trying to the build system image for Julia v0.7: Julia-0.7.0-DEV\> include(joinpath(JULIA\_HOME, Base.DATAROOTDIR, "julia", "build\_sysimg.jl")) Julia-0.7.0-DEV\> build\_sysimg(force=true) # cpu\_target="native" Afte…

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

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