# General Usage

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

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

**Page:** 1039

---

## [Factor() function not defined error](https://discourse.julialang.org/t/factor-function-not-defined-error/4768)

<div class="topic-metadata">

**Author:** [@ephemeris](https://discourse.julialang.org/u/ephemeris)\
**Replies:** 1\
**Last updated:** [July 10, 2017, 5:04pm UTC](https://discourse.julialang.org/t/factor-function-not-defined-error/4768 "2017-07-10T17:04:04Z")

</div>

There is factor function described in julia docs. However if try it in REPL I get \>factor(100) ERROR: UndefVarError: factor not defined If I search docs from REPL i get help?\> factor search: factorize factorial Factor…

---

## [Defining a variable according to an if-else statement](https://discourse.julialang.org/t/defining-a-variable-according-to-an-if-else-statement/4763)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 13\
**Last updated:** [July 10, 2017, 3:40pm UTC](https://discourse.julialang.org/t/defining-a-variable-according-to-an-if-else-statement/4763 "2017-07-10T15:40:19Z")

</div>

Sometimes I need to define a variable based on a branch like: foo = \[\] if condition foo = "Julia" else foo = "is awesome" end but I need to define it outside of the branch so that it becomes visible in the outside …

---

## [How to validate the URL for a file](https://discourse.julialang.org/t/how-to-validate-the-url-for-a-file/4757)

<div class="topic-metadata">

**Author:** [@pochoi](https://discourse.julialang.org/u/pochoi)\
**Replies:** 0\
**Last updated:** [July 10, 2017, 12:44pm UTC](https://discourse.julialang.org/t/how-to-validate-the-url-for-a-file/4757 "2017-07-10T12:44:26Z")

</div>

Suppose I have a file with the following url I need to download it in Julia ftp://hello.com/world.zip. How to validate the URL before downloading it? Motivations of my question: The silly servers in my workspace som…

---

## [LibCURL: (1) Compatible w/ 0.6? (2) --data switch work?](https://discourse.julialang.org/t/libcurl-1-compatible-w-0-6-2-data-switch-work/4755)

<div class="topic-metadata">

**Author:** [@aether](https://discourse.julialang.org/u/aether)\
**Replies:** 1\
**Last updated:** [July 10, 2017, 12:20pm UTC](https://discourse.julialang.org/t/libcurl-1-compatible-w-0-6-2-data-switch-work/4755 "2017-07-10T12:20:42Z")

</div>

Hi, two questions re: LibCURL. First, is it compatible with Julia 0.6? Second, does it support the --data switch? For example, ‘curl www.domain.com’ retrieves the website. ‘curl --data query=‘I’m a lumberjack and I’…

---

## [Defining pow :^ does not have a fallback for irrationals (method ambiguous)](https://discourse.julialang.org/t/defining-pow-does-not-have-a-fallback-for-irrationals-method-ambiguous/4751)

<div class="topic-metadata">

**Author:** [@musm](https://discourse.julialang.org/u/musm)\
**Replies:** 6\
**Last updated:** [July 10, 2017, 7:59am UTC](https://discourse.julialang.org/t/defining-pow-does-not-have-a-fallback-for-irrationals-method-ambiguous/4751 "2017-07-10T07:59:52Z")

</div>

julia\> struct Test \<: AbstractFloat x end julia\> Base.:^(x::Number, y::Test) = x^(y.x) # does not work julia\> e^Test(2.0) ERROR: MethodError: ^(::Irrational{:e}, ::Test) is ambiguous. Candidates: ^(x::…

---

## [Behavior of comprehensions](https://discourse.julialang.org/t/behavior-of-comprehensions/4750)

<div class="topic-metadata">

**Author:** [@bkamins](https://discourse.julialang.org/u/bkamins)\
**Replies:** 1\
**Last updated:** [July 9, 2017, 5:58pm UTC](https://discourse.julialang.org/t/behavior-of-comprehensions/4750 "2017-07-09T17:58:35Z")

</div>

I have just realized that nested comprehensions have two non-obvious properties. Consider the following code: julia\> f(i, j) = (println((i,j)); (i,j)) f (generic function with 1 method) …

---

## [Pkg.add("SymEngine") fails](https://discourse.julialang.org/t/pkg-add-symengine-fails/4749)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 5\
**Last updated:** [July 9, 2017, 5:58pm UTC](https://discourse.julialang.org/t/pkg-add-symengine-fails/4749 "2017-07-09T17:58:08Z")

</div>

Installing SymEngine fails with the following error on Julia 0.6, Ubuntu 16.04: julia\> Pkg.build("SymEngine") INFO: Building Conda INFO: Building SymEngine ERROR requests.packages.urllib3.connection:\_match\_hostname(360)…

---

## [Opening up an Expr for easier manipulation](https://discourse.julialang.org/t/opening-up-an-expr-for-easier-manipulation/4747)

<div class="topic-metadata">

**Author:** [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Replies:** 3\
**Last updated:** [July 9, 2017, 1:15pm UTC](https://discourse.julialang.org/t/opening-up-an-expr-for-easier-manipulation/4747 "2017-07-09T13:15:09Z")

</div>

in the relm of metaprogramming: Given an arbitrary well-formed Expr that contains zero or more symbols, to replace each symbol by a value chosen as its referent (given in an available Dict) one assigns into the appropria…

---

## [Building error for "Sundials", "SymEngine", "Rmath", wrong julia directory](https://discourse.julialang.org/t/building-error-for-sundials-symengine-rmath-wrong-julia-directory/4745)

<div class="topic-metadata">

**Author:** [@wood](https://discourse.julialang.org/u/wood)\
**Replies:** 3\
**Last updated:** [July 9, 2017, 1:28am UTC](https://discourse.julialang.org/t/building-error-for-sundials-symengine-rmath-wrong-julia-directory/4745 "2017-07-09T01:28:07Z")

</div>

Hello, I met a building error when adding DifferentialEquations package, “LoadError: could not spawn 'D:\\Program Files\\JuliaPro-0.5.2.2\\Julia-0.6.0\\bin\\7z.exe' x 'C:\\Users\\Wood\\.julia\\v0.6\\Sundials\\deps\\downloads\\sundia…

---

## [How can I use a package (mine) as a sub Package](https://discourse.julialang.org/t/how-can-i-use-a-package-mine-as-a-sub-package/4738)

<div class="topic-metadata">

**Author:** [@DrKrar](https://discourse.julialang.org/u/DrKrar)\
**Replies:** 2\
**Last updated:** [July 8, 2017, 3:13pm UTC](https://discourse.julialang.org/t/how-can-i-use-a-package-mine-as-a-sub-package/4738 "2017-07-08T15:13:35Z")

</div>

I know that i can use a package code to build up on. but i did not how i can do that without copying.

---

## [Type stability when arguments are functions](https://discourse.julialang.org/t/type-stability-when-arguments-are-functions/4734)

<div class="topic-metadata">

**Author:** [@dpo](https://discourse.julialang.org/u/dpo)\
**Replies:** 7\
**Last updated:** [July 8, 2017, 2:10pm UTC](https://discourse.julialang.org/t/type-stability-when-arguments-are-functions/4734 "2017-07-08T14:10:22Z")

</div>

Sorry if this has been asked before. I have functions that take vectors of functions as arguments, similarly to the following: function g2(fs::Vector{Function}, x::Float64)::Float64 a::Float64 = 0.0 for f …

---

## [Performance of array broadcasting](https://discourse.julialang.org/t/performance-of-array-broadcasting/4724)

<div class="topic-metadata">

**Author:** [@xqrongm](https://discourse.julialang.org/u/xqrongm)\
**Replies:** 11\
**Last updated:** [July 8, 2017, 1:59pm UTC](https://discourse.julialang.org/t/performance-of-array-broadcasting/4724 "2017-07-08T13:59:45Z")

</div>

Julia v0.6.0. I have the following snippets. I wonder why “snippet\_1” is so much more efficient than the others. Is it possible to make the others as efficient as “snippet\_1”? Thanks! i\_ = 40 j\_ = 16 a1 = rand(i\_,j\_,2);…

---

## [How to add unregistered packages to REQUIRE?](https://discourse.julialang.org/t/how-to-add-unregistered-packages-to-require/4737)

<div class="topic-metadata">

**Author:** [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Replies:** 2\
**Last updated:** [July 8, 2017, 10:03am UTC](https://discourse.julialang.org/t/how-to-add-unregistered-packages-to-require/4737 "2017-07-08T10:03:39Z")

</div>

How can I add an unregistered package to REQUIRE to be installed automatically?

---

## [Questions on a number of code acceleration techniques](https://discourse.julialang.org/t/questions-on-a-number-of-code-acceleration-techniques/4733)

<div class="topic-metadata">

**Author:** [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Replies:** 11\
**Last updated:** [July 8, 2017, 9:41am UTC](https://discourse.julialang.org/t/questions-on-a-number-of-code-acceleration-techniques/4733 "2017-07-08T09:41:34Z")

</div>

I have been trying to step up my game in Julia by thinking more parallel and speed to make the fastest version of my code, and I find myself faced with a number of not-so-thoroughly-documented options so I have a few que…

---

## [Generalizing bounds checking](https://discourse.julialang.org/t/generalizing-bounds-checking/4704)

<div class="topic-metadata">

**Author:** [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Replies:** 7\
**Last updated:** [July 8, 2017, 4:45am UTC](https://discourse.julialang.org/t/generalizing-bounds-checking/4704 "2017-07-08T04:45:03Z")

</div>

I’ve found myself on several occasions wanting a safe-but-slow version as well as an unsafe-but-fast version of a function. @boundscheck and @inbounds solve this problem marvelously for array indexing, but that’s not exa…

---

## [Exponentially long compile times in generated functions that disappear after manual inlining](https://discourse.julialang.org/t/exponentially-long-compile-times-in-generated-functions-that-disappear-after-manual-inlining/4702)

<div class="topic-metadata">

**Author:** [@braydenware](https://discourse.julialang.org/u/braydenware)\
**Replies:** 4\
**Last updated:** [July 8, 2017, 4:34am UTC](https://discourse.julialang.org/t/exponentially-long-compile-times-in-generated-functions-that-disappear-after-manual-inlining/4702 "2017-07-08T04:34:06Z")

</div>

I have been using TensorOperations.jl for fast N-dimensional Array operations, which are written using generated functions that produce N nested @simd for loops. I discovered that while the runtime of these functions is …

---

## [IndexedTables.Columns: incrementally build?](https://discourse.julialang.org/t/indexedtables-columns-incrementally-build/4735)

<div class="topic-metadata">

**Author:** [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Replies:** 0\
**Last updated:** [July 8, 2017, 1:46am UTC](https://discourse.julialang.org/t/indexedtables-columns-incrementally-build/4735 "2017-07-08T01:46:48Z")

</div>

Is it possible to build up a Columns value with multiple parts incrementally? to accomplish: mycols = IndexedTables.Columns(timestamps=ts) mycols = push!(mycols, newcol=newvals )

---

## [Juno not showing error messages](https://discourse.julialang.org/t/juno-not-showing-error-messages/4706)

<div class="topic-metadata">

**Author:** [@nickeubank](https://discourse.julialang.org/u/nickeubank)\
**Replies:** 3\
**Last updated:** [July 7, 2017, 7:43pm UTC](https://discourse.julialang.org/t/juno-not-showing-error-messages/4706 "2017-07-07T19:43:43Z")

</div>

New to julia, running into odd problem. In some cases, when I run commands in the console, I’m not getting errors. For example: No errors, no feedback nothing. Similarly, if I execute by highlighting and hitting “shi…

---

## [Julia Package: different branches for different Julia-versions?](https://discourse.julialang.org/t/julia-package-different-branches-for-different-julia-versions/4718)

<div class="topic-metadata">

**Author:** [@luchr](https://discourse.julialang.org/u/luchr)\
**Replies:** 3\
**Last updated:** [July 7, 2017, 5:32pm UTC](https://discourse.julialang.org/t/julia-package-different-branches-for-different-julia-versions/4718 "2017-07-07T17:32:48Z")

</div>

I’m the owner of the ODEInterface package and I have the following question. At the moment I’ve written the code in such a way, that it runs under julia v0.4, v0.5 and v0.6 without any warnings. Because of the changes in…

---

## [Understanding changes from Case Study: Rational Conversions](https://discourse.julialang.org/t/understanding-changes-from-case-study-rational-conversions/4722)

<div class="topic-metadata">

**Author:** [@hpoit](https://discourse.julialang.org/u/hpoit)\
**Replies:** 1\
**Last updated:** [July 7, 2017, 6:42pm UTC](https://discourse.julialang.org/t/understanding-changes-from-case-study-rational-conversions/4722 "2017-07-07T18:42:28Z")

</div>

Hello! How do I find the issue commenting on the changes made from https://docs.julialang.org/en/stable/manual/conversion-and-promotion/#man-rational-conversion-1 to https://github.com/JuliaLang/julia/blob/master/base/…

---

## [Check out tagged commit of unregistered package](https://discourse.julialang.org/t/check-out-tagged-commit-of-unregistered-package/4659)

<div class="topic-metadata">

**Author:** [@kkmann](https://discourse.julialang.org/u/kkmann)\
**Replies:** 11\
**Last updated:** [July 7, 2017, 2:35pm UTC](https://discourse.julialang.org/t/check-out-tagged-commit-of-unregistered-package/4659 "2017-07-07T14:35:35Z")

</div>

Hi, the title pretty much says it all. I have an unregistered package not ready for being published and would still like to be able to install specific versions using tags. I know I could use branches via Pkg.checkout(…

---

## [Regular expressions returning offsets in bytes not characters](https://discourse.julialang.org/t/regular-expressions-returning-offsets-in-bytes-not-characters/4676)

<div class="topic-metadata">

**Author:** [@cstook](https://discourse.julialang.org/u/cstook)\
**Replies:** 9\
**Last updated:** [July 7, 2017, 1:19pm UTC](https://discourse.julialang.org/t/regular-expressions-returning-offsets-in-bytes-not-characters/4676 "2017-07-07T13:19:47Z")

</div>

Hello, Regular expressions seems to be returning offsets in bytes not characters. Is this the intended behavior? Is there a way to get the offsets in characters? julia\> m1 = match(r"(3).\*(5)"ix,"123a56789") RegexMatc…

---

## [Undefined constructor is executed](https://discourse.julialang.org/t/undefined-constructor-is-executed/4703)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 4\
**Last updated:** [July 7, 2017, 6:19am UTC](https://discourse.julialang.org/t/undefined-constructor-is-executed/4703 "2017-07-07T06:19:35Z")

</div>

Consider the following type: julia\> VERSION v"0.6.1-pre.0" julia\> struct MyType{T} x::Float64 y::T end According to this documentation, such type definition implicitly defines an outer con…

---

## [Difference between \`new\` and \`new{T}\`](https://discourse.julialang.org/t/difference-between-new-and-new-t/4707)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 1\
**Last updated:** [July 7, 2017, 4:24am UTC](https://discourse.julialang.org/t/difference-between-new-and-new-t/4707 "2017-07-07T04:24:38Z")

</div>

I understand new{T}(...) must be used instead of new(...) to define an outer constructor inside struct ... end (to define an outer-only constructor, for example). However, when defining an inner constructor, is there an…

---

## [Does this qualify as a bug?](https://discourse.julialang.org/t/does-this-qualify-as-a-bug/4665)

<div class="topic-metadata">

**Author:** [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Replies:** 6\
**Last updated:** [July 6, 2017, 6:06pm UTC](https://discourse.julialang.org/t/does-this-qualify-as-a-bug/4665 "2017-07-06T18:06:03Z")

</div>

Following the advice, that you can do proper debugging by inserting print/display commands, i’ve put some (3) print/displays into a function of BinDeps to trace what library option are evalutated and this works in the fi…

---

## [Constructor with optional argument of type Union{T,Void}](https://discourse.julialang.org/t/constructor-with-optional-argument-of-type-union-t-void/4693)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 2\
**Last updated:** [July 6, 2017, 4:50pm UTC](https://discourse.julialang.org/t/constructor-with-optional-argument-of-type-union-t-void/4693 "2017-07-06T16:50:35Z")

</div>

I am getting an error with a type in my package: https://github.com/juliohm/GeoStats.jl/blob/master/src/empirical\_variograms.jl There I define an optional argument maxlag for the constructor. When I omit the argument, I…

---

## [Selecting NaN for different machine precision](https://discourse.julialang.org/t/selecting-nan-for-different-machine-precision/4692)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 8\
**Last updated:** [July 6, 2017, 4:47pm UTC](https://discourse.julialang.org/t/selecting-nan-for-different-machine-precision/4692 "2017-07-06T16:47:29Z")

</div>

Currently I am defining the following function to get type stability a la one and zero for single and double precision: nan(::Type{Float32}) = NaN32 nan(::Type{Float64}) = NaN64 Inside of my function I call it with the…

---

## [Type with StaticArrays field](https://discourse.julialang.org/t/type-with-staticarrays-field/4618)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon](https://discourse.julialang.org/u/Philippe_Maincon)\
**Replies:** 10\
**Last updated:** [July 6, 2017, 1:52pm UTC](https://discourse.julialang.org/t/type-with-staticarrays-field/4618 "2017-07-06T13:52:44Z")

</div>

Hi, I want to create a specialised high-performance automatic differentiation type. So I propose to use StaticArrays, so that temporary variables in mathematical expressions do not result in pointer allocations, deallo…

---

## [Documentation general index](https://discourse.julialang.org/t/documentation-general-index/4686)

<div class="topic-metadata">

**Author:** [@j2b2](https://discourse.julialang.org/u/j2b2)\
**Replies:** 0\
**Last updated:** [July 6, 2017, 12:07pm UTC](https://discourse.julialang.org/t/documentation-general-index/4686 "2017-07-06T12:07:48Z")

</div>

Hello, https://docs.julialang.org/en/release-0.5/genindex/ is ok, but https://docs.julialang.org/en/release-0.6/genindex/ https://docs.julialang.org/en/stable/genindex/ display 404 error. Bug or feature ?

---

## [Error with .parameters in nested parametric types](https://discourse.julialang.org/t/error-with-parameters-in-nested-parametric-types/4678)

<div class="topic-metadata">

**Author:** [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Replies:** 7\
**Last updated:** [July 6, 2017, 7:27am UTC](https://discourse.julialang.org/t/error-with-parameters-in-nested-parametric-types/4678 "2017-07-06T07:27:55Z")

</div>

I am trying to extract the Float64 from the type below, works in v0.5, breaks in v0.6. Apparently something to do with DataType vs UnionAll. julia\> t = Dict{String, Array{Float64}} Dict{String,Array{Float64,N} where N} …

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

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