# General Usage

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

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

**Page:** 1062

---

## [Parametric type parameter calculation for supertype](https://discourse.julialang.org/t/parametric-type-parameter-calculation-for-supertype/2427)

<div class="topic-metadata">

**Author:** [@barche](https://discourse.julialang.org/u/barche)\
**Replies:** 3\
**Last updated:** [March 3, 2017, 4:38pm UTC](https://discourse.julialang.org/t/parametric-type-parameter-calculation-for-supertype/2427 "2017-03-03T16:38:06Z")

</div>

Is it possible to define a type abstract Bar{PtrT,N} \<: AbstractArray{T,N} Such that PtrT is a Ptr{T}? i.e. I want Bar to be defined in terms of a pointer type, but have it implement the AbstractArray interface for th…

---

## [Macro inside constructor fails on 0.6](https://discourse.julialang.org/t/macro-inside-constructor-fails-on-0-6/2422)

<div class="topic-metadata">

**Author:** [@abelsiqueira](https://discourse.julialang.org/u/abelsiqueira)\
**Replies:** 3\
**Last updated:** [March 3, 2017, 4:17pm UTC](https://discourse.julialang.org/t/macro-inside-constructor-fails-on-0-6/2422 "2017-03-03T16:17:12Z")

</div>

The following code works on 0.5, but not on 0.6 (0.6.0-pre.alpha.0) macro macroex(n) :(println($n)) end type MWE nvar :: Int x0 :: Array{Float64,1} function MWE(nvar) x0 = zeros(nvar) @macroex nvar #…

---

## [Linking against Julia's internal openBLAS](https://discourse.julialang.org/t/linking-against-julias-internal-openblas/2409)

<div class="topic-metadata">

**Author:** [@TsurHerman](https://discourse.julialang.org/u/TsurHerman)\
**Replies:** 3\
**Last updated:** [March 3, 2017, 2:54pm UTC](https://discourse.julialang.org/t/linking-against-julias-internal-openblas/2409 "2017-03-03T14:54:46Z")

</div>

I have C code that I want to compile to a dll (windows platform) so I can ccall it from julia. The C code is dependent on openBLAS . I want to link it against libopenblas64\_.dll that is present in the julia bin\\ direct…

---

## [Case statement equivalent?](https://discourse.julialang.org/t/case-statement-equivalent/2418)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 2\
**Last updated:** [March 3, 2017, 9:44am UTC](https://discourse.julialang.org/t/case-statement-equivalent/2418 "2017-03-03T09:44:55Z")

</div>

What I want to do… data = Foo Int | Bar Float case x Foo y → print “it’s an int”, y Bar y → print “it’s a float”, y Is there a way to approximate this ?

---

## [AMD64 Multi-CPU Compile Flags](https://discourse.julialang.org/t/amd64-multi-cpu-compile-flags/2415)

<div class="topic-metadata">

**Author:** [@anon51122801](https://discourse.julialang.org/u/anon51122801)\
**Replies:** 6\
**Last updated:** [March 3, 2017, 12:04am UTC](https://discourse.julialang.org/t/amd64-multi-cpu-compile-flags/2415 "2017-03-03T00:04:13Z")

</div>

I blew away the previous install of Julia 0.6.0-dev and are redoing 0.5 as per the instructions: https://github.com/JuliaLang/julia/tree/v0.5.0 $ cd /../git $ git clone git://github.com/JuliaLang/julia.git ... git gits…

---

## [Pass specific function as argument](https://discourse.julialang.org/t/pass-specific-function-as-argument/2413)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 3\
**Last updated:** [March 2, 2017, 9:49pm UTC](https://discourse.julialang.org/t/pass-specific-function-as-argument/2413 "2017-03-02T21:49:04Z")

</div>

I have defined two methods f(x::Int) and f(x::Float64)with different signatures. I would like to pass one of the two, say f(::Int) as the argument of another function, g(f::Function). How can I do that in v0.5?

---

## [Scope in metaprogramming](https://discourse.julialang.org/t/scope-in-metaprogramming/2378)

<div class="topic-metadata">

**Author:** [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Replies:** 17\
**Last updated:** [March 2, 2017, 8:57pm UTC](https://discourse.julialang.org/t/scope-in-metaprogramming/2378 "2017-03-02T20:57:40Z")

</div>

I am trying to define a function that delegates a task to a set of internal, very similar subfunctions. These subfunctions need access to names in the scope of the defining function. Sounds like a job for metaprogrammin…

---

## [How to stop a server created using Mux?](https://discourse.julialang.org/t/how-to-stop-a-server-created-using-mux/2380)

<div class="topic-metadata">

**Author:** [@Sarvjeet](https://discourse.julialang.org/u/Sarvjeet)\
**Replies:** 2\
**Last updated:** [March 1, 2017, 8:30pm UTC](https://discourse.julialang.org/t/how-to-stop-a-server-created-using-mux/2380 "2017-03-01T20:30:11Z")

</div>

Eg : using Mux @app test = ( Mux.defaults, page(respond("\<h1\>Yo!\</h1\>")), page("/about", probabilty(0.5, respond("\<h1\>Boo tati!\</h1\>")), respond("\<h1\>About Me\</h1\>")), page("/user/:user", req -\> "\<h1\>Hello, $…

---

## [Populating a 3D array with discretely sampled scalar field](https://discourse.julialang.org/t/populating-a-3d-array-with-discretely-sampled-scalar-field/2369)

<div class="topic-metadata">

**Author:** [@dcyang](https://discourse.julialang.org/u/dcyang)\
**Replies:** 5\
**Last updated:** [March 1, 2017, 11:49am UTC](https://discourse.julialang.org/t/populating-a-3d-array-with-discretely-sampled-scalar-field/2369 "2017-03-01T11:49:08Z")

</div>

Hi, I’m trying to populate a 3D array (predetermined size of about a million) with values of a Float64 function on a cartesian grid. I think the term for this is “discretely sampled volumetric data” in scientific visua…

---

## [\`compile=no\`?](https://discourse.julialang.org/t/compile-no/2372)

<div class="topic-metadata">

**Author:** [@ulysses](https://discourse.julialang.org/u/ulysses)\
**Replies:** 1\
**Last updated:** [March 1, 2017, 2:36am UTC](https://discourse.julialang.org/t/compile-no/2372 "2017-03-01T02:36:26Z")

</div>

Hello! I’m experimenting with Julia compile switch. Setting it to no gives an errors for simplest programs like print(1): code missing for Base.pointer(Base.#pointer, Array{UInt8, 1}, UInt64) sysimg may not have been …

---

## [UndefVarError when including a snippet of code](https://discourse.julialang.org/t/undefvarerror-when-including-a-snippet-of-code/2376)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 6\
**Last updated:** [March 1, 2017, 2:19am UTC](https://discourse.julialang.org/t/undefvarerror-when-including-a-snippet-of-code/2376 "2017-03-01T02:19:23Z")

</div>

Imagine that you have many plotting calls that you’re using to debug the code that you are developing. At some point you want to be able to erase the plotting code quickly, commit the changes on git and reinsert the plot…

---

## [Tuple constructor on 0.6 with convert](https://discourse.julialang.org/t/tuple-constructor-on-0-6-with-convert/2358)

<div class="topic-metadata">

**Author:** [@musm](https://discourse.julialang.org/u/musm)\
**Replies:** 4\
**Last updated:** [March 1, 2017, 12:09am UTC](https://discourse.julialang.org/t/tuple-constructor-on-0-6-with-convert/2358 "2017-03-01T00:09:58Z")

</div>

The following works on 0.5 but not on 0.6 julia\> immutable Test1{T\<:AbstractFloat} \<: Number x::T y::T end julia\> import Base.convert; convert{T}(::Type{Tuple{T,T}}, x…

---

## [Is there a way to tell if a method is pure?](https://discourse.julialang.org/t/is-there-a-way-to-tell-if-a-method-is-pure/2355)

<div class="topic-metadata">

**Author:** [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Replies:** 3\
**Last updated:** [February 28, 2017, 11:12pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-tell-if-a-method-is-pure/2355 "2017-02-28T23:12:29Z")

</div>

While drilling through Method fields, I’ve found method.source.pure flag. Does it mean there’s some analysis involved indicating if the function is pure, i.e. doesn’t modify its inputs?

---

## [Give hints to Julia's GC about size of memory allocated through C calls](https://discourse.julialang.org/t/give-hints-to-julias-gc-about-size-of-memory-allocated-through-c-calls/2367)

<div class="topic-metadata">

**Author:** [@leethargo](https://discourse.julialang.org/u/leethargo)\
**Replies:** 2\
**Last updated:** [February 28, 2017, 3:48pm UTC](https://discourse.julialang.org/t/give-hints-to-julias-gc-about-size-of-memory-allocated-through-c-calls/2367 "2017-02-28T15:48:13Z")

</div>

In SCIP.jl, we build a wrapper for a C library. There’s a Julia type SCIPModel that basically holds a Pointer to a C struct. In the constructor, we call a corresponding initializer of the C library that allocates signifi…

---

## [Multithreading with CartesianRange bug?](https://discourse.julialang.org/t/multithreading-with-cartesianrange-bug/2351)

<div class="topic-metadata">

**Author:** [@ksmcreynolds](https://discourse.julialang.org/u/ksmcreynolds)\
**Replies:** 1\
**Last updated:** [February 28, 2017, 1:51pm UTC](https://discourse.julialang.org/t/multithreading-with-cartesianrange-bug/2351 "2017-02-28T13:51:43Z")

</div>

I am adding a 2D array multiplied by a constant to each 2D slice of a 3D array as part of a larger code. The function simply loops over all the indices to perform the calculation. To increase the speed of the computation…

---

## [Figuring out behaviour of expression interpolation](https://discourse.julialang.org/t/figuring-out-behaviour-of-expression-interpolation/2357)

<div class="topic-metadata">

**Author:** [@Ward9250](https://discourse.julialang.org/u/Ward9250)\
**Replies:** 3\
**Last updated:** [February 28, 2017, 11:36am UTC](https://discourse.julialang.org/t/figuring-out-behaviour-of-expression-interpolation/2357 "2017-02-28T11:36:19Z")

</div>

I have a simple function that generates code, for a generated function I want to make: function issite\_gen(operation, N) ex = :($operation(arr\[1\])) for i in 2:N ex = :($ex | $operation(arr\[$i\])) end …

---

## [How should I declare “abstract container type” fields in v0.6?](https://discourse.julialang.org/t/how-should-i-declare-abstract-container-type-fields-in-v0-6/2325)

<div class="topic-metadata">

**Author:** [@Glen](https://discourse.julialang.org/u/Glen)\
**Replies:** 7\
**Last updated:** [February 28, 2017, 8:46am UTC](https://discourse.julialang.org/t/how-should-i-declare-abstract-container-type-fields-in-v0-6/2325 "2017-02-28T08:46:46Z")

</div>

Hi, Is there an updated information for how to create an abstract container type in v0.6? Here’s the corresponding info for 0.4: How should I declare “abstract container type” fields? Is it now recommended to inherit…

---

## [Ndim (\>=3) Array constructors without argument does not work](https://discourse.julialang.org/t/ndim-3-array-constructors-without-argument-does-not-work/2353)

<div class="topic-metadata">

**Author:** [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Replies:** 4\
**Last updated:** [February 27, 2017, 11:08pm UTC](https://discourse.julialang.org/t/ndim-3-array-constructors-without-argument-does-not-work/2353 "2017-02-27T23:08:18Z")

</div>

Hi, I am wondering why the default constructors without an argument for Array, e.g., Array{Float64,1}() and Array{Float64,2}() work without any problems while Array{Float64,3}() gives the following error? Closest candid…

---

## [Importing Python Module in Julia: MESA\_reader](https://discourse.julialang.org/t/importing-python-module-in-julia-mesa-reader/2345)

<div class="topic-metadata">

**Author:** [@astrowanders](https://discourse.julialang.org/u/astrowanders)\
**Replies:** 1\
**Last updated:** [February 27, 2017, 7:40pm UTC](https://discourse.julialang.org/t/importing-python-module-in-julia-mesa-reader/2345 "2017-02-27T19:40:31Z")

</div>

Hello, I would like to preface my question with a note that MESA is a stellar evolution code (http://mesa.sourceforge.net/) I’m trying to import mesa\_reader - a Python module for reading MESA output - with PyCall, but …

---

## [Atom+juno on ubuntu mate 16.04](https://discourse.julialang.org/t/atom-juno-on-ubuntu-mate-16-04/2248)

<div class="topic-metadata">

**Author:** [@mazzanti](https://discourse.julialang.org/u/mazzanti)\
**Replies:** 4\
**Last updated:** [February 27, 2017, 6:18pm UTC](https://discourse.julialang.org/t/atom-juno-on-ubuntu-mate-16-04/2248 "2017-02-27T18:18:00Z")

</div>

Hi, sorry if I’m posting in the wrong place… I don’t know what is the right place to ask this, so please tell me if you know :slight\_smile: The fact is that I’m trying to install the Juno IDE on my Ubuntu mate 16.04 bo…

---

## [Precompiling my own functions returns true/false](https://discourse.julialang.org/t/precompiling-my-own-functions-returns-true-false/2303)

<div class="topic-metadata">

**Author:** [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Replies:** 8\
**Last updated:** [February 27, 2017, 6:09pm UTC](https://discourse.julialang.org/t/precompiling-my-own-functions-returns-true-false/2303 "2017-02-27T18:09:09Z")

</div>

Hello. I wrote a set of functions myself (with julia v0.5.0), and wanted to precompile them using precompile, e.g., precompile(myfunc, (Matrix{Float64}, Vector{Int64})), etc. Now, precompile returns true on some of my fu…

---

## [Find path of imported module](https://discourse.julialang.org/t/find-path-of-imported-module/2254)

<div class="topic-metadata">

**Author:** [@bastikr](https://discourse.julialang.org/u/bastikr)\
**Replies:** 5\
**Last updated:** [February 27, 2017, 4:57pm UTC](https://discourse.julialang.org/t/find-path-of-imported-module/2254 "2017-02-27T16:57:04Z")

</div>

Is there a simple way to find out from where a module is imported? I.e. something like using Foo path(Foo)

---

## [Methods() returning duplicate results?](https://discourse.julialang.org/t/methods-returning-duplicate-results/2323)

<div class="topic-metadata">

**Author:** [@barche](https://discourse.julialang.org/u/barche)\
**Replies:** 1\
**Last updated:** [February 27, 2017, 12:17pm UTC](https://discourse.julialang.org/t/methods-returning-duplicate-results/2323 "2017-02-27T12:17:28Z")

</div>

The methods function appears to return duplicate results in this case, is that a bug? REPL input: foo(arg1::Union{Int32,Int64}, arg2::Union{Float64,Int64}) = 1 methods(foo, (Union{Int32,Int64},Union{Float64,Int64})) o…

---

## [Initialising a dictionary with duplicate keys](https://discourse.julialang.org/t/initialising-a-dictionary-with-duplicate-keys/2290)

<div class="topic-metadata">

**Author:** [@odow](https://discourse.julialang.org/u/odow)\
**Replies:** 3\
**Last updated:** [February 26, 2017, 5:38pm UTC](https://discourse.julialang.org/t/initialising-a-dictionary-with-duplicate-keys/2290 "2017-02-26T17:38:18Z")

</div>

Is this expected behaviour (on v0.5. Haven’t tested v0.6)? It seems like it should at least throw a warning. julia\> Dict(:x=\>1, :x=\>2) Dict{Symbol, Int} with 1 entry: :x =\> 2

---

## [Variables in macro definition](https://discourse.julialang.org/t/variables-in-macro-definition/2307)

<div class="topic-metadata">

**Author:** [@gasagna](https://discourse.julialang.org/u/gasagna)\
**Replies:** 3\
**Last updated:** [February 26, 2017, 11:03am UTC](https://discourse.julialang.org/t/variables-in-macro-definition/2307 "2017-02-26T11:03:02Z")

</div>

I am developing a macro that lets me write sums in a nice way. A trivial example is: # some array x = \[1, 2, 3\] # calculate sum s = @Σ i=1:3 x\[i\] I have tried this: module MyModule export @Σ # fancy macro to write …

---

## [Hov to convert pseudo hex to Int ? e.g. 'F' = 16](https://discourse.julialang.org/t/hov-to-convert-pseudo-hex-to-int-e-g-f-16/2314)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 3\
**Last updated:** [February 26, 2017, 9:37am UTC](https://discourse.julialang.org/t/hov-to-convert-pseudo-hex-to-int-e-g-f-16/2314 "2017-02-26T09:37:04Z")

</div>

Hov to conver pseudo hex to Int ? I need convert ‘1’ \>1 ‘2’ \>2 … ‘F’ \>16 ‘G’ \>17 julia\> typeof(woj16) Array{Any,1} julia\> typeof(woj16\[1\]) Char julia\> sort(unique(woj16)) 16-element Array{Any,1}: ‘1’ ‘2’ ‘…

---

## [Unions vs adding methods](https://discourse.julialang.org/t/unions-vs-adding-methods/2298)

<div class="topic-metadata">

**Author:** [@barche](https://discourse.julialang.org/u/barche)\
**Replies:** 11\
**Last updated:** [February 25, 2017, 6:12pm UTC](https://discourse.julialang.org/t/unions-vs-adding-methods/2298 "2017-02-25T18:12:20Z")

</div>

I just read up on Unions, and I get the impression that approach A and B below would be exactly equivalent: int32\_only\_eater(i::Int32) = println(i) # Approach A eatint(i::Int32) = int32\_only\_eater(i) eatint(i::Int64) =…

---

## [Making a plot with related y-axes](https://discourse.julialang.org/t/making-a-plot-with-related-y-axes/2282)

<div class="topic-metadata">

**Author:** [@thejas.wesley](https://discourse.julialang.org/u/thejas.wesley)\
**Replies:** 1\
**Last updated:** [February 25, 2017, 5:54pm UTC](https://discourse.julialang.org/t/making-a-plot-with-related-y-axes/2282 "2017-02-25T17:54:14Z")

</div>

Hello! I’m trying to make a plot (using PyPlot) with two y-axes that are interrelated (one is essentially the inverse of the other). To clarify, I have one set of data, but want the two related y-axes in order to practi…

---

## [Algorithm to plot sample distribution](https://discourse.julialang.org/t/algorithm-to-plot-sample-distribution/2287)

<div class="topic-metadata">

**Author:** [@Laura\_Macciocchi](https://discourse.julialang.org/u/Laura_Macciocchi)\
**Replies:** 2\
**Last updated:** [February 25, 2017, 1:20am UTC](https://discourse.julialang.org/t/algorithm-to-plot-sample-distribution/2287 "2017-02-25T01:20:28Z")

</div>

I have this exercise but i got stuck j=1

---

## [Julia homebrew install git Error](https://discourse.julialang.org/t/julia-homebrew-install-git-error/1863)

<div class="topic-metadata">

**Author:** [@smores](https://discourse.julialang.org/u/smores)\
**Replies:** 1\
**Last updated:** [February 24, 2017, 11:47pm UTC](https://discourse.julialang.org/t/julia-homebrew-install-git-error/1863 "2017-02-24T23:47:04Z")

</div>

julia\> Pkg.init() INFO: Initializing package repository /var/root/.julia/v0.5 INFO: Cloning METADATA from https://github.com/JuliaLang/METADATA.jl ERROR: GitError(Code:ERROR, Class:Invalid, Invalid version 0 on git\_pr…

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

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