# General Usage

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

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

**Page:** 1035

---

## [Indexing operation results in \`::ANY\` using \`code\_warntype\`](https://discourse.julialang.org/t/indexing-operation-results-in-any-using-code-warntype/5145)

<div class="topic-metadata">

**Author:** [@stillyslalom](https://discourse.julialang.org/u/stillyslalom)\
**Replies:** 1\
**Last updated:** [July 31, 2017, 1:53am UTC](https://discourse.julialang.org/t/indexing-operation-results-in-any-using-code-warntype/5145 "2017-07-31T01:53:43Z")

</div>

MWE on Julia 0.6, OSX x64 binary release; let me know if I should file a bug report. Seems as if the type of u0 should be easy to infer. init(f, x) = f.(x) function test(f, nx) x = linspace(0., 1., nx) u = init(…

---

## [Regular expression (regex) for updating to \`where\` syntax](https://discourse.julialang.org/t/regular-expression-regex-for-updating-to-where-syntax/5141)

<div class="topic-metadata">

**Author:** [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Replies:** 1\
**Last updated:** [July 30, 2017, 9:07pm UTC](https://discourse.julialang.org/t/regular-expression-regex-for-updating-to-where-syntax/5141 "2017-07-30T21:07:21Z")

</div>

I thought the following would be useful for those updating packages to 0.7, which has deprecated the old syntax f{T}(x::T) in favour of using where f(x::T) where T. These are two regular expressions that I use in Atom’s …

---

## [ANN: LazyQuery.jl](https://discourse.julialang.org/t/ann-lazyquery-jl/4789)

<div class="topic-metadata">

**Author:** [@bramtayl](https://discourse.julialang.org/u/bramtayl)\
**Replies:** 1\
**Last updated:** [July 30, 2017, 4:52pm UTC](https://discourse.julialang.org/t/ann-lazyquery-jl/4789 "2017-07-30T16:52:19Z")

</div>

I’ve just released LazyQuery. It currently provides an intuitive dplyr-like interface to Query. Being built on LazyContext, there are exciting possibilities for specialized/optimized code interpretation for various data-…

---

## [Building Julia 0.6.0 with MKL on OSX 10.12.5](https://discourse.julialang.org/t/building-julia-0-6-0-with-mkl-on-osx-10-12-5/5073)

<div class="topic-metadata">

**Author:** [@tross](https://discourse.julialang.org/u/tross)\
**Replies:** 8\
**Last updated:** [July 30, 2017, 4:41pm UTC](https://discourse.julialang.org/t/building-julia-0-6-0-with-mkl-on-osx-10-12-5/5073 "2017-07-30T16:41:50Z")

</div>

Hello, I am new to this so please forgive my naive approach. I have been trying to build Julia using the intel MKL in addition to the intel c++ and fortran compilers on OS X 10.12.5. However, I have been running into a…

---

## [Parametric types and where keyword in Julia v0.6](https://discourse.julialang.org/t/parametric-types-and-where-keyword-in-julia-v0-6/5123)

<div class="topic-metadata">

**Author:** [@scidom](https://discourse.julialang.org/u/scidom)\
**Replies:** 6\
**Last updated:** [July 29, 2017, 10:14pm UTC](https://discourse.julialang.org/t/parametric-types-and-where-keyword-in-julia-v0-6/5123 "2017-07-29T22:14:24Z")

</div>

The following typealias used to work in Julia v0.5: typealias RealLowerTriangular{T\<:Real, S\<:AbstractMatrix} LowerTriangular{T, S} Upon upgrading to Julia v0.6, I received a suggestion on the REPL to use instead the f…

---

## [AxisArrays and image stack](https://discourse.julialang.org/t/axisarrays-and-image-stack/5052)

<div class="topic-metadata">

**Author:** [@phlavenk](https://discourse.julialang.org/u/phlavenk)\
**Replies:** 1\
**Last updated:** [July 29, 2017, 8:21am UTC](https://discourse.julialang.org/t/axisarrays-and-image-stack/5052 "2017-07-29T08:21:42Z")

</div>

I’d like to use the AxisArray structure in my program for processing a series of images aquired by a microscope. The images in the stack are tiles of larger area with some overlap. Each image has the same properties but …

---

## [Test cases and isolation](https://discourse.julialang.org/t/test-cases-and-isolation/5120)

<div class="topic-metadata">

**Author:** [@sambitdash](https://discourse.julialang.org/u/sambitdash)\
**Replies:** 0\
**Last updated:** [July 29, 2017, 6:42am UTC](https://discourse.julialang.org/t/test-cases-and-isolation/5120 "2017-07-29T06:42:55Z")

</div>

Hi All, Recently I was writing some test cases for the PDF library I am developing but wanted to isolate test cases in a manner that failure of one test case should not affect the subsequent tests significantly. My code…

---

## [Is there a file separator constant for a specific operating system](https://discourse.julialang.org/t/is-there-a-file-separator-constant-for-a-specific-operating-system/5104)

<div class="topic-metadata">

**Author:** [@sambitdash](https://discourse.julialang.org/u/sambitdash)\
**Replies:** 3\
**Last updated:** [July 29, 2017, 2:04am UTC](https://discourse.julialang.org/t/is-there-a-file-separator-constant-for-a-specific-operating-system/5104 "2017-07-29T02:04:26Z")

</div>

Hi All, I was trying to split a directory for path and filename in a code. Was not aware of existence of splitdir() method. So I wrote a code like: rsplit(filepath, “/”, limit=2)\[2\] to get the filename. Julia didn’t se…

---

## [Type instability of plus and the like](https://discourse.julialang.org/t/type-instability-of-plus-and-the-like/5094)

<div class="topic-metadata">

**Author:** [@StreetLevel](https://discourse.julialang.org/u/StreetLevel)\
**Replies:** 6\
**Last updated:** [July 29, 2017, 1:21am UTC](https://discourse.julialang.org/t/type-instability-of-plus-and-the-like/5094 "2017-07-29T01:21:22Z")

</div>

I’ve come across this particularity in basic functions. I believe this has to do with the flat evaluation of +(a,b,c...) instead of recursion. I would assume that the julia compiler would inline a recursion for a+b+...+z.…

---

## [LHS qualifier of const ignored by dispatch](https://discourse.julialang.org/t/lhs-qualifier-of-const-ignored-by-dispatch/5082)

<div class="topic-metadata">

**Author:** [@Jameson\_Quinn](https://discourse.julialang.org/u/Jameson_Quinn)\
**Replies:** 3\
**Last updated:** [July 28, 2017, 5:16pm UTC](https://discourse.julialang.org/t/lhs-qualifier-of-const-ignored-by-dispatch/5082 "2017-07-28T17:16:02Z")

</div>

I have the following: const ScalarVariateVal = Real const ArrayVariateVal{N,VT\<: ScalarVariateVal} = DenseArray{VT, N} const DictVariateVal{K,VT\<: ScalarVariateVal} = Associative{K, VT} const AbstractVariateVal…

---

## [Argument Passing Problem in Julia Version 0.6.0](https://discourse.julialang.org/t/argument-passing-problem-in-julia-version-0-6-0/5095)

<div class="topic-metadata">

**Author:** [@gopal2017](https://discourse.julialang.org/u/gopal2017)\
**Replies:** 3\
**Last updated:** [July 28, 2017, 1:30pm UTC](https://discourse.julialang.org/t/argument-passing-problem-in-julia-version-0-6-0/5095 "2017-07-28T13:30:36Z")

</div>

Hello, I faced a strange problem. My code is working well in Julia Version 0.5.2 but facing problem in Julia 0.6.0. For sake of simplicity, I am giving small code mentioned below: function s(x) A1=AbstractString for …

---

## [Performance hit when using callbacks](https://discourse.julialang.org/t/performance-hit-when-using-callbacks/5107)

<div class="topic-metadata">

**Author:** [@krcools](https://discourse.julialang.org/u/krcools)\
**Replies:** 1\
**Last updated:** [July 28, 2017, 9:56am UTC](https://discourse.julialang.org/t/performance-hit-when-using-callbacks/5107 "2017-07-28T09:56:23Z")

</div>

I am trying to assemble a matrix using multiple processes. To make sure each process writes to the part of the matrix it owns, I am using a callback as one of the arguments to the single process jobs launched by the driv…

---

## [World age error when constructing dataframe](https://discourse.julialang.org/t/world-age-error-when-constructing-dataframe/5069)

<div class="topic-metadata">

**Author:** [@YongHee-Kim](https://discourse.julialang.org/u/YongHee-Kim)\
**Replies:** 4\
**Last updated:** [July 28, 2017, 9:28am UTC](https://discourse.julialang.org/t/world-age-error-when-constructing-dataframe/5069 "2017-07-28T09:28:03Z")

</div>

I get world age error when I’m constructing some form of dataframe. (I’m on Julia Version 0.6.0 Commit 903644385b\* (2017-06-19 13:05 UTC) with Windows OS) here is my example code to reproduce this error using DataFram…

---

## [What is the precedence between assignment operator \`=\` and the anonymous function operator \`-\>\`?](https://discourse.julialang.org/t/what-is-the-precedence-between-assignment-operator-and-the-anonymous-function-operator/5083)

<div class="topic-metadata">

**Author:** [@tparker](https://discourse.julialang.org/u/tparker)\
**Replies:** 3\
**Last updated:** [July 28, 2017, 2:44am UTC](https://discourse.julialang.org/t/what-is-the-precedence-between-assignment-operator-and-the-anonymous-function-operator/5083 "2017-07-28T02:44:51Z")

</div>

Julia parses the command f = x -\> x^2 # (1) as f = (x -\> x^2) # (2) This parsing is reasonable, because expression (2) is clearly what any user would mean in a real application. However, Base.operator\_preced…

---

## [Reinterpret SVector](https://discourse.julialang.org/t/reinterpret-svector/4996)

<div class="topic-metadata">

**Author:** [@StreetLevel](https://discourse.julialang.org/u/StreetLevel)\
**Replies:** 2\
**Last updated:** [July 27, 2017, 2:30pm UTC](https://discourse.julialang.org/t/reinterpret-svector/4996 "2017-07-27T14:30:18Z")

</div>

Hello everyone, I’ve got a question regarding the usage of reinterpret in combination with StaticArrays.SVector: As described in the readme something like “”“julia x = rand(3,3) reinterpret(SVector{3,Float64}, x, (3…

---

## [Constructors a la AbstractArray](https://discourse.julialang.org/t/constructors-a-la-abstractarray/5003)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 12\
**Last updated:** [July 27, 2017, 12:07pm UTC](https://discourse.julialang.org/t/constructors-a-la-abstractarray/5003 "2017-07-27T12:07:14Z")

</div>

Suppose I have a regular grid defined as follows: abstract type AbstractDomain{N,T\<:Real} end struct RegularGrid{N,T\<:Real} \<: AbstractDomain{N,T} dims::Dims{N} origin::NTuple{N,T} units::NTuple{N,T} end I am tr…

---

## [Protect from @](https://discourse.julialang.org/t/protect-from/5088)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [July 27, 2017, 7:26am UTC](https://discourse.julialang.org/t/protect-from/5088 "2017-07-27T07:26:25Z")

</div>

Is there a way not to broadcast some part of an expression with @.? MWE: xs = (1, 2) λs = (0.1, 0.2) log.(xs) + log.(1.-xs) + log.(1. + rev(xs). + xs. \* λs) (note: no broadcasting for rev) would be much more convenient…

---

## [Why doesn't \`broadcast\` work with anonymous functions?](https://discourse.julialang.org/t/why-doesnt-broadcast-work-with-anonymous-functions/5085)

<div class="topic-metadata">

**Author:** [@tparker](https://discourse.julialang.org/u/tparker)\
**Replies:** 2\
**Last updated:** [July 27, 2017, 4:08am UTC](https://discourse.julialang.org/t/why-doesnt-broadcast-work-with-anonymous-functions/5085 "2017-07-27T04:08:09Z")

</div>

evaluate(f, x::Int64) = f(x); evaluate.(x -\> x^2, \[1, 2, 3\]) Gives the error MethodError: no method matching size(::##1#2). What’s wrong with the above code? I’m using version 0.5.0.

---

## [Less verbose way of avoiding type instability?](https://discourse.julialang.org/t/less-verbose-way-of-avoiding-type-instability/5058)

<div class="topic-metadata">

**Author:** [@evanfields](https://discourse.julialang.org/u/evanfields)\
**Replies:** 5\
**Last updated:** [July 26, 2017, 10:24pm UTC](https://discourse.julialang.org/t/less-verbose-way-of-avoiding-type-instability/5058 "2017-07-26T22:24:07Z")

</div>

I have a simple wrapper type like so: struct Wrapper{T \<: Real} x::AbstractMatrix{T} y::AbstractVector{T} end and a simple function operating on Wrapper objects: f(w) = w.x \* w.y The problem is that f(w::Wrapper) s…

---

## [Unit tests with random seed: local vs Travis](https://discourse.julialang.org/t/unit-tests-with-random-seed-local-vs-travis/5041)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 14\
**Last updated:** [July 26, 2017, 6:08am UTC](https://discourse.julialang.org/t/unit-tests-with-random-seed-local-vs-travis/5041 "2017-07-26T06:08:26Z")

</div>

I am working on a library for Hamiltonian Monte Carlo methods (I am aware of other libraries, but I want to experiment with some new methods). It has some test where it samples from a distribution, then obtains statist…

---

## [\`addprocs(\["remote"\])\` does not work, but \`ssh remote julia --version\` does. why?](https://discourse.julialang.org/t/addprocs-remote-does-not-work-but-ssh-remote-julia-version-does-why/3400)

<div class="topic-metadata">

**Author:** [@floswald](https://discourse.julialang.org/u/floswald)\
**Replies:** 10\
**Last updated:** [July 26, 2017, 12:53am UTC](https://discourse.julialang.org/t/addprocs-remote-does-not-work-but-ssh-remote-julia-version-does-why/3400 "2017-07-26T00:53:23Z")

</div>

I see this behaviour ➜ ~ julia \_ \_ \_ \_(\_)\_ | A fresh approach to technical computing (\_) | (\_) (\_) | Documentation: http://docs.julialang.org \_ \_ \_| |\_ \_\_ \_ | Type "?help…

---

## [PyPlot in Julia: Thousands Separator](https://discourse.julialang.org/t/pyplot-in-julia-thousands-separator/5029)

<div class="topic-metadata">

**Author:** [@davidzentlermunro](https://discourse.julialang.org/u/davidzentlermunro)\
**Replies:** 2\
**Last updated:** [July 25, 2017, 10:16pm UTC](https://discourse.julialang.org/t/pyplot-in-julia-thousands-separator/5029 "2017-07-25T22:16:29Z")

</div>

Anyone know how to translate this suggestion to julia: https://preinventedwheel.com/matplotlib-thousands-separator-1-step-guide/ It’s something like: ax\[:xaxis\]\[:set\_major\_formatter\](matplotlib\[:ticker\]\[:FuncFormatter…

---

## [Why I use Julia](https://discourse.julialang.org/t/why-i-use-julia/4819)

<div class="topic-metadata">

**Author:** [@Nectarineimp](https://discourse.julialang.org/u/Nectarineimp)\
**Replies:** 5\
**Last updated:** [July 25, 2017, 9:00pm UTC](https://discourse.julialang.org/t/why-i-use-julia/4819 "2017-07-25T21:00:47Z")

</div>

I want to state why I use Julia and what excites me about it so that others who come here looking to get an understanding of the language will be encouraged by someone who uses it professionally. I’d love to see replies …

---

## [Memory Debugging](https://discourse.julialang.org/t/memory-debugging/5067)

<div class="topic-metadata">

**Author:** [@ilker](https://discourse.julialang.org/u/ilker)\
**Replies:** 1\
**Last updated:** [July 25, 2017, 8:08pm UTC](https://discourse.julialang.org/t/memory-debugging/5067 "2017-07-25T20:08:23Z")

</div>

I implemented a complex neural net by using Knet/AutoGrad. Then, I realized that RAM usage of my experiment gets bigger and bigger slowly in the training even though it was a GPU experiment. In simpler models, I don’t ha…

---

## [Behaviour of \`norm(::Vector{\<:Vector},p)\`](https://discourse.julialang.org/t/behaviour-of-norm-vector-vector-p/5059)

<div class="topic-metadata">

**Author:** [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Replies:** 3\
**Last updated:** [July 25, 2017, 6:35pm UTC](https://discourse.julialang.org/t/behaviour-of-norm-vector-vector-p/5059 "2017-07-25T18:35:45Z")

</div>

This caught me by surprise: norm(\[\[1,2\],\[3,4\]\],1) == norm(\[1,2\],2)+norm(\[3,4\],2) # == 7.24… ≠ 10 I had expected the norm of the components to be consistent with the norm of the vector. Is this intentional?

---

## [Modifier Function Naming Style](https://discourse.julialang.org/t/modifier-function-naming-style/5047)

<div class="topic-metadata">

**Author:** [@clinton](https://discourse.julialang.org/u/clinton)\
**Replies:** 2\
**Last updated:** [July 25, 2017, 2:17am UTC](https://discourse.julialang.org/t/modifier-function-naming-style/5047 "2017-07-25T02:17:11Z")

</div>

Say I have the following trivial function: function foo(A, x, b=Vector{Float64}(length(x))) b .= A \* x return b end My question is, should the function be named foo, foo!, or should I break this into two functions?…

---

## [Setting multiple columns in DataFrames](https://discourse.julialang.org/t/setting-multiple-columns-in-dataframes/5046)

<div class="topic-metadata">

**Author:** [@mirestrepo](https://discourse.julialang.org/u/mirestrepo)\
**Replies:** 1\
**Last updated:** [July 24, 2017, 7:59pm UTC](https://discourse.julialang.org/t/setting-multiple-columns-in-dataframes/5046 "2017-07-24T19:59:26Z")

</div>

Is there a one-line way to set multiple columns of DataFrame row? Seems like a trivial question, but can’t find a way to do it. Suppose I have: df = DataFrame(a = \[5, 6, 7\], b = \[55, 66, 77\]) The following and any si…

---

## [Maximum(x) uses memory differently for different sized array views](https://discourse.julialang.org/t/maximum-x-uses-memory-differently-for-different-sized-array-views/4339)

<div class="topic-metadata">

**Author:** [@bingcrosby](https://discourse.julialang.org/u/bingcrosby)\
**Replies:** 7\
**Last updated:** [July 24, 2017, 6:56pm UTC](https://discourse.julialang.org/t/maximum-x-uses-memory-differently-for-different-sized-array-views/4339 "2017-07-24T18:56:02Z")

</div>

Hello all, it’s nice to be using and posting about Julia. I need to use the maximum() function on SubArrays, and have observed some results which confuse me based on the shape of the original array. Essentially, I have …

---

## [Possible to bypass cert verification in Requests.jl or HTTP.jl?](https://discourse.julialang.org/t/possible-to-bypass-cert-verification-in-requests-jl-or-http-jl/5032)

<div class="topic-metadata">

**Author:** [@josefsachs](https://discourse.julialang.org/u/josefsachs)\
**Replies:** 3\
**Last updated:** [July 24, 2017, 6:47pm UTC](https://discourse.julialang.org/t/possible-to-bypass-cert-verification-in-requests-jl-or-http-jl/5032 "2017-07-24T18:47:58Z")

</div>

Is there a way that I can bypass cert verification in Requests.jl or HTTP.jl (i.e., as a client), similar to curl’s -k option? -k, --insecure (TLS) By default, every SSL connection curl makes is v…

---

## [Performance of using strings as keys in Dict (vs. integers)](https://discourse.julialang.org/t/performance-of-using-strings-as-keys-in-dict-vs-integers/4926)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 8\
**Last updated:** [July 24, 2017, 1:34pm UTC](https://discourse.julialang.org/t/performance-of-using-strings-as-keys-in-dict-vs-integers/4926 "2017-07-24T13:34:13Z")

</div>

I have a large Dictionary, and currently I am using strings as keys. I am getting bad performance, which could be related to this (but I am not sure). I am wondering if it makes sense to rewrite the code so that the Dict…

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

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