# General Usage

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

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

**Page:** 966

---

## [Best way to have an optional return value?](https://discourse.julialang.org/t/best-way-to-have-an-optional-return-value/12184)

<div class="topic-metadata">

**Author:** [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Replies:** 9\
**Last updated:** [July 7, 2018, 6:23am UTC](https://discourse.julialang.org/t/best-way-to-have-an-optional-return-value/12184 "2018-07-07T06:23:56Z")

</div>

I am starting to enjoy many features of Julia. I just haven’t found the best way to provide an optional return value. Lets say we have a function (improvised not compiled) function myAlg(x::Float,y::Float) if x \> y …

---

## [How to check whether a identifier is defined within the current scope?](https://discourse.julialang.org/t/how-to-check-whether-a-identifier-is-defined-within-the-current-scope/7470)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 5\
**Last updated:** [July 6, 2018, 10:26pm UTC](https://discourse.julialang.org/t/how-to-check-whether-a-identifier-is-defined-within-the-current-scope/7470 "2018-07-06T22:26:33Z")

</div>

Hi everyone, Is there a way to check whether an identifier is defined in the current scope? function f(x) z =1 already\_defined = #check whether z is defined here if already\_defined z = do\_stuff\_on(z…

---

## [Reducing latency in parallel computing](https://discourse.julialang.org/t/reducing-latency-in-parallel-computing/12214)

<div class="topic-metadata">

**Author:** [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Replies:** 0\
**Last updated:** [July 6, 2018, 3:56pm UTC](https://discourse.julialang.org/t/reducing-latency-in-parallel-computing/12214 "2018-07-06T15:56:42Z")

</div>

I have an embarrassingly parallel problem that I’d like to solve with Julia’s parallelism constructs, but I’m seeing a lot of latency and unexpected allocations. To demonstrate my issue, I’ll construct a dummy problem wh…

---

## [How to set gap between multiple scatter plot - Plotly](https://discourse.julialang.org/t/how-to-set-gap-between-multiple-scatter-plot-plotly/12145)

<div class="topic-metadata">

**Author:** [@mvcavalcanti](https://discourse.julialang.org/u/mvcavalcanti)\
**Replies:** 2\
**Last updated:** [July 5, 2018, 8:30pm UTC](https://discourse.julialang.org/t/how-to-set-gap-between-multiple-scatter-plot-plotly/12145 "2018-07-05T20:30:18Z")

</div>

Hi. I’d like to compare values of two different cases through scatter plots and basically this is what I have now: As you can see, each correspondent variable of my cases are above the another. What I would like to …

---

## [How to auto import what upper module has imported to the inner module](https://discourse.julialang.org/t/how-to-auto-import-what-upper-module-has-imported-to-the-inner-module/12193)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 0\
**Last updated:** [July 5, 2018, 7:39pm UTC](https://discourse.julialang.org/t/how-to-auto-import-what-upper-module-has-imported-to-the-inner-module/12193 "2018-07-05T19:39:58Z")

</div>

Hi fellows, I have question module Outer using X.Y.Z import A.B module GeneratedInner #include statements end end I need to write a macro which can get what outer module has imported and re import…

---

## [bug report calling julia from python](https://discourse.julialang.org/t/bug-report-calling-julia-from-python/12177)

<div class="topic-metadata">

**Author:** [@Hz\_Wang](https://discourse.julialang.org/u/Hz_Wang)\
**Replies:** 0\
**Last updated:** [July 5, 2018, 12:29pm UTC](https://discourse.julialang.org/t/bug-report-calling-julia-from-python/12177 "2018-07-05T12:29:37Z")

</div>

Try to call julia0.6.3 from python 3.6 at the first place. Blockquote \>\>\> import julia j=julia.Julia() Please submit a bug report with steps to reproduce this fault, and any error mes sages that follow (in the…

---

## [How to revert dirty packages](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122)

<div class="topic-metadata">

**Author:** [@pitao](https://discourse.julialang.org/u/pitao)\
**Replies:** 13\
**Last updated:** [July 5, 2018, 4:09am UTC](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122 "2018-07-05T04:09:53Z")

</div>

My Pkg.status() is: julia\> Pkg.status() 1 required packages: - Atom 0.5.9+ master 45 additional packages: - ASTInterpreter 0.0.4+ master : - HttpCommon…

---

## [Deprecated @unix and @unix\_only macros in Mmap](https://discourse.julialang.org/t/deprecated-unix-and-unix-only-macros-in-mmap/12137)

<div class="topic-metadata">

**Author:** [@pegger0709](https://discourse.julialang.org/u/pegger0709)\
**Replies:** 1\
**Last updated:** [July 5, 2018, 2:12am UTC](https://discourse.julialang.org/t/deprecated-unix-and-unix-only-macros-in-mmap/12137 "2018-07-05T02:12:42Z")

</div>

Hello, I need Mmap in order to run the NIfTI package and when I run Pkg.test(“Mmap”), I get the following error message: julia\> Pkg.test("Mmap") INFO: Testing Mmap ERROR: LoadError: LoadError: UndefVarError: @unix not …

---

## [Create new regex from previously existing regex](https://discourse.julialang.org/t/create-new-regex-from-previously-existing-regex/12156)

<div class="topic-metadata">

**Author:** [@Naelson\_douglas](https://discourse.julialang.org/u/Naelson_douglas)\
**Replies:** 5\
**Last updated:** [July 5, 2018, 1:10am UTC](https://discourse.julialang.org/t/create-new-regex-from-previously-existing-regex/12156 "2018-07-05T01:10:16Z")

</div>

I have a regular expression to match integers just like this type\_int = r"\\s\*\[0-9\]\*$" And I would like to create a regular expression to match by using my type\_int definition inside the type\_float definition on someth…

---

## [Pkg.update() fails ](https://discourse.julialang.org/t/pkg-update-fails/12116)

<div class="topic-metadata">

**Author:** [@Phillip\_Gurman](https://discourse.julialang.org/u/Phillip_Gurman)\
**Replies:** 2\
**Last updated:** [July 5, 2018, 12:29am UTC](https://discourse.julialang.org/t/pkg-update-fails/12116 "2018-07-05T00:29:34Z")

</div>

I am having trouble getting julia to update on Ubuntu 18.04 running in WSL on Windows 10 version 1709. Pkg.update() takes a few minutes to return the following error. Any ideas would be greatly appreciated. \_ \_ ()…

---

## [A question about parametric types](https://discourse.julialang.org/t/a-question-about-parametric-types/12149)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 13\
**Last updated:** [July 4, 2018, 7:32pm UTC](https://discourse.julialang.org/t/a-question-about-parametric-types/12149 "2018-07-04T19:32:29Z")

</div>

Hi I have the following problem: struct MyType{T} end function get\_root\_type(typ::Type) #what goes here? end rt = get\_root\_type(MyType{Int}) i need rt to contain type MyType , without any parameter. Is there a way …

---

## [Non-reproducable \[REPL help, but really GC\] bug in 0.5.2; report this or other bugs in old versions?](https://discourse.julialang.org/t/non-reproducable-repl-help-but-really-gc-bug-in-0-5-2-report-this-or-other-bugs-in-old-versions/12167)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 1\
**Last updated:** [July 4, 2018, 6:41pm UTC](https://discourse.julialang.org/t/non-reproducable-repl-help-but-really-gc-bug-in-0-5-2-report-this-or-other-bugs-in-old-versions/12167 "2018-07-04T18:41:36Z")

</div>

EDIT: I see now just minutes after with top “65956 free” (I often see lower, and get OOM, e.g. for firefox processes, not sure it happened now), in case memory/resources run out, can and should/does(current Julia?) Julia…

---

## [Invalid escape sequence](https://discourse.julialang.org/t/invalid-escape-sequence/12154)

<div class="topic-metadata">

**Author:** [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Replies:** 2\
**Last updated:** [July 4, 2018, 4:51pm UTC](https://discourse.julialang.org/t/invalid-escape-sequence/12154 "2018-07-04T16:51:57Z")

</div>

In Windows, the autocomplete (i.e. tab) will add a backslash before any whitespaces. e.g. If I want to include a file which is in a folder with whitespaces, I get the error below (second line) Is this expected? I am n…

---

## [Print functions in a threaded loop](https://discourse.julialang.org/t/print-functions-in-a-threaded-loop/12112)

<div class="topic-metadata">

**Author:** [@Yimuon](https://discourse.julialang.org/u/Yimuon)\
**Replies:** 11\
**Last updated:** [July 4, 2018, 3:04pm UTC](https://discourse.julialang.org/t/print-functions-in-a-threaded-loop/12112 "2018-07-04T15:04:46Z")

</div>

I have a question about print(or println) functions inside a threaded loop. If I added print functions in a threaded loop, the julia would just keep running and have no output. For example, Threads.@threads for ii in …

---

## [Pkg on Travis: Behavior different on different platforms?](https://discourse.julialang.org/t/pkg-on-travis-behavior-different-on-different-platforms/12155)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 2\
**Last updated:** [July 4, 2018, 1:05pm UTC](https://discourse.julialang.org/t/pkg-on-travis-behavior-different-on-different-platforms/12155 "2018-07-04T13:05:28Z")

</div>

Julia Version 0.7.0-beta.133. This succeeds on Appveyor: C:\\projects\\julia\\bin\\julia -e "import Pkg; Pkg.develop(\\"https://github.com/PetrKryslUCSD/FinEtools.jl.git\\"); Pkg.test(\\"FinEtools\\")" while this fails on Trav…

---

## [\[ANN\] VisualDL.jl A Julia wrapper for VisualDL aims for deep learning visualization](https://discourse.julialang.org/t/ann-visualdl-jl-a-julia-wrapper-for-visualdl-aims-for-deep-learning-visualization/12095)

<div class="topic-metadata">

**Author:** [@findmyway](https://discourse.julialang.org/u/findmyway)\
**Replies:** 2\
**Last updated:** [July 4, 2018, 4:19am UTC](https://discourse.julialang.org/t/ann-visualdl-jl-a-julia-wrapper-for-visualdl-aims-for-deep-learning-visualization/12095 "2018-07-04T04:19:59Z")

</div>

I just wrote a wrapper for VisualDL with PyCall. https://github.com/findmyway/VisualDL.jl Hope it would be helpful to visualize your deep learning algorithms~ Also, this is my first registered package in Julia …

---

## [Random effect MixedModels](https://discourse.julialang.org/t/random-effect-mixedmodels/12120)

<div class="topic-metadata">

**Author:** [@ktsiamasiotis](https://discourse.julialang.org/u/ktsiamasiotis)\
**Replies:** 6\
**Last updated:** [July 3, 2018, 6:12pm UTC](https://discourse.julialang.org/t/random-effect-mixedmodels/12120 "2018-07-03T18:12:14Z")

</div>

Hi, I used MixedModels package a couple of times in the past as a faster alternative to R’s lmer. Recently I downloaded latest official Julia version (0.6.3) and tried with some datasets. I compared the results with ol…

---

## [Updating HyperDualNumbers (in JuliaDiff)](https://discourse.julialang.org/t/updating-hyperdualnumbers-in-juliadiff/5360)

<div class="topic-metadata">

**Author:** [@goedman](https://discourse.julialang.org/u/goedman)\
**Replies:** 4\
**Last updated:** [July 3, 2018, 2:44pm UTC](https://discourse.julialang.org/t/updating-hyperdualnumbers-in-juliadiff/5360 "2018-07-03T14:44:00Z")

</div>

Hi, I’ve been trying to update HyperDualNumbers but can’t use Attobot, maybe because I’m not an owner of JuliaDiff? I also have similar issues with appveyor.yml. Any way around this (except maybe using the old way with …

---

## [(Auto)-formatting code?](https://discourse.julialang.org/t/auto-formatting-code/1611)

<div class="topic-metadata">

**Author:** [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Replies:** 13\
**Last updated:** [July 3, 2018, 2:26pm UTC](https://discourse.julialang.org/t/auto-formatting-code/1611 "2018-07-03T14:26:51Z")

</div>

I’ve lost track of this. Is there a known configuration of an available editor or a tool, that just corrects formatting of julia code? (like gofmt or crtl-A, crtl-I in medit).

---

## [IterTools and Visualization](https://discourse.julialang.org/t/itertools-and-visualization/12107)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 1\
**Last updated:** [July 3, 2018, 7:11am UTC](https://discourse.julialang.org/t/itertools-and-visualization/12107 "2018-07-03T07:11:29Z")

</div>

I used pmap with IterTools and product to do a a parameter study on a problem, so now I have a scalar quantity of interest generated by 3x3x3x3 different parameters. What I would like to do is plot the quantity with one…

---

## [Subtype of every other type](https://discourse.julialang.org/t/subtype-of-every-other-type/12117)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 1\
**Last updated:** [July 3, 2018, 3:42am UTC](https://discourse.julialang.org/t/subtype-of-every-other-type/12117 "2018-07-03T03:42:57Z")

</div>

Is there type which is subtype of every other type in julia? Void \<: Int return false.

---

## [Fullpath of a type](https://discourse.julialang.org/t/fullpath-of-a-type/12113)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 2\
**Last updated:** [July 2, 2018, 11:24pm UTC](https://discourse.julialang.org/t/fullpath-of-a-type/12113 "2018-07-02T23:24:11Z")

</div>

how can i get the full path of a type? module Z export UU struct UU end end using Z fullpath = some\_func(UU) fullpath to be Z.UU does such a function exist? Thanks

---

## [Residuals from LinearMixed Models (Julia 0.6.3)](https://discourse.julialang.org/t/residuals-from-linearmixed-models-julia-0-6-3/12103)

<div class="topic-metadata">

**Author:** [@Harish\_Kumar](https://discourse.julialang.org/u/Harish_Kumar)\
**Replies:** 2\
**Last updated:** [July 2, 2018, 10:06pm UTC](https://discourse.julialang.org/t/residuals-from-linearmixed-models-julia-0-6-3/12103 "2018-07-02T22:06:16Z")

</div>

I am in the process of migrating the Julia .3.2 version to 0.6.3 … We had a function/variable in 0.3.2 “resid” to extract the residual from the model. Do we have any equivalent function in 0.6.3? lmm= fit!(LinearMixedMo…

---

## [Inconsistent bounds-checking of tuples](https://discourse.julialang.org/t/inconsistent-bounds-checking-of-tuples/12102)

<div class="topic-metadata">

**Author:** [@cafaxo](https://discourse.julialang.org/u/cafaxo)\
**Replies:** 6\
**Last updated:** [July 2, 2018, 9:55pm UTC](https://discourse.julialang.org/t/inconsistent-bounds-checking-of-tuples/12102 "2018-07-02T21:55:17Z")

</div>

As expected, (1,)\[2\] throws an out-of-bounds error: julia\> (1,)\[2\] ERROR: BoundsError: attempt to access (1,) at index \[2\] Doing this, however, does not throw an error: julia\> struct Test end julia\> (Test(),)\[2\] Te…

---

## [@which and applicable report uncallable method](https://discourse.julialang.org/t/which-and-applicable-report-uncallable-method/12108)

<div class="topic-metadata">

**Author:** [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Replies:** 2\
**Last updated:** [July 2, 2018, 9:42pm UTC](https://discourse.julialang.org/t/which-and-applicable-report-uncallable-method/12108 "2018-07-02T21:42:38Z")

</div>

Am I correct in thinking this is a bug in Julia ? julia\> applicable(iterate,Int) true julia\> iterate(Int) ERROR: MethodError: no method matching iterate(::Type{Int64}) Closest candidates are: iterate(::Any) at essent…

---

## [What is wrong with getfield?](https://discourse.julialang.org/t/what-is-wrong-with-getfield/12105)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 3\
**Last updated:** [July 2, 2018, 8:34pm UTC](https://discourse.julialang.org/t/what-is-wrong-with-getfield/12105 "2018-07-02T20:34:27Z")

</div>

module RRW struct YU end end const modsym = RRW getfield(modsym,:YU) ERROR: UndefVarError: YU not defined this doesn’t happen when i do the following: getfield(RRW,:YU) RRW.YU Why does this happen?

---

## [What to use in v0.7 in place of \`Pkg.dir\`](https://discourse.julialang.org/t/what-to-use-in-v0-7-in-place-of-pkg-dir/12090)

<div class="topic-metadata">

**Author:** [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Replies:** 11\
**Last updated:** [July 2, 2018, 6:48pm UTC](https://discourse.julialang.org/t/what-to-use-in-v0-7-in-place-of-pkg-dir/12090 "2018-07-02T18:48:46Z")

</div>

In v0.7.0-beta the use of Pkg.dir produces a warning julia\> using Pkg julia\> Pkg.dir("Statistics") ┌ Warning: Pkg.dir is only kept for legacy CI script reasons └ @ Pkg.API API.jl:432 "/home/bates/git/julia/usr/share/ju…

---

## [Cannot build 0.7 system image in MacOS](https://discourse.julialang.org/t/cannot-build-0-7-system-image-in-macos/12087)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 5\
**Last updated:** [July 2, 2018, 1:17pm UTC](https://discourse.julialang.org/t/cannot-build-0-7-system-image-in-macos/12087 "2018-07-02T13:17:26Z")

</div>

I built the system image but it failed consistency check when I restart Julia, even though it said “System image successfully built”. MacOS. Anyone had success before and is there any advice? thanks $ /Applications/J…

---

## [Type Intersection in Arrays](https://discourse.julialang.org/t/type-intersection-in-arrays/12035)

<div class="topic-metadata">

**Author:** [@cortner](https://discourse.julialang.org/u/cortner)\
**Replies:** 29\
**Last updated:** [July 2, 2018, 9:06am UTC](https://discourse.julialang.org/t/type-intersection-in-arrays/12035 "2018-07-02T09:06:28Z")

</div>

Suppose I have a x::Vector{Any} (or another abstract type) but in fact all elements of x are Float64, then I can recover a Vector{Float64} using y = \[t for t in x\] so I don’t even need to specify what the intersection …

---

## [Newbie Syntax Help: Colon in Index Syntax ---\> sepal\_length\_column = iris\[:Sepal\_Length\]](https://discourse.julialang.org/t/newbie-syntax-help-colon-in-index-syntax-sepal-length-column-iris-sepal-length/11918)

<div class="topic-metadata">

**Author:** [@Eli\_Hughes](https://discourse.julialang.org/u/Eli_Hughes)\
**Replies:** 6\
**Last updated:** [July 2, 2018, 8:45am UTC](https://discourse.julialang.org/t/newbie-syntax-help-colon-in-index-syntax-sepal-length-column-iris-sepal-length/11918 "2018-07-02T08:45:28Z")

</div>

Hello: I need some help to a doc page for a particular syntax (keep in mind I am a c programmer…) I have seen code that looks like this: sepal\_length\_column = iris\[:Sepal\_Length\] In the case above, it was an ex…

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

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