# General Usage

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

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

**Page:** 1010

---

## [IJulia build changing conda channel for some python packages within conda environment](https://discourse.julialang.org/t/ijulia-build-changing-conda-channel-for-some-python-packages-within-conda-environment/7665)

<div class="topic-metadata">

**Author:** [@Copper](https://discourse.julialang.org/u/Copper)\
**Replies:** 0\
**Last updated:** [December 10, 2017, 1:19am UTC](https://discourse.julialang.org/t/ijulia-build-changing-conda-channel-for-some-python-packages-within-conda-environment/7665 "2017-12-10T01:19:59Z")

</div>

When building the IJulia package which is set up to make use of the Conda package and Anaconda most up to date Python 3 installation (with specific sub enviroment ‘conda\_jl’ I designated for Julia to be precise), some (8…

---

## [How to invoke next-most-specific method?](https://discourse.julialang.org/t/how-to-invoke-next-most-specific-method/7664)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 2\
**Last updated:** [December 9, 2017, 10:46pm UTC](https://discourse.julialang.org/t/how-to-invoke-next-most-specific-method/7664 "2017-12-09T22:46:41Z")

</div>

I was recently super pleasantly surprised to discover the invoke method, invoke(f, types \<: Tuple, args…) Invoke a method for the given generic function matching the specified types, on the specified arguments. The ar…

---

## [Best way to construct a sparse matrix](https://discourse.julialang.org/t/best-way-to-construct-a-sparse-matrix/7657)

<div class="topic-metadata">

**Author:** [@lbittarello](https://discourse.julialang.org/u/lbittarello)\
**Replies:** 3\
**Last updated:** [December 9, 2017, 7:29pm UTC](https://discourse.julialang.org/t/best-way-to-construct-a-sparse-matrix/7657 "2017-12-09T19:29:04Z")

</div>

Hi! I’m writing a function that constructs a symmetric sparse matrix. I’ve tried two implementations: function version1(x::Vector{Date}, k::Function) n = length(x) mat = speye(Float64, n, n) for i = 1:n…

---

## [Identation in Juno](https://discourse.julialang.org/t/identation-in-juno/7651)

<div class="topic-metadata">

**Author:** [@dharasim](https://discourse.julialang.org/u/dharasim)\
**Replies:** 2\
**Last updated:** [December 9, 2017, 7:04pm UTC](https://discourse.julialang.org/t/identation-in-juno/7651 "2017-12-09T19:04:33Z")

</div>

I like to write lists and list comprehensions in multiple lines like: a = \[ 1, 2 \] This is fine in Julia, but In Juno, however, this doesn’t work. I have to write one of those two versions: a = \[ 1, 2 …

---

## [Why isn't \`pointer(Cint(0))\` valid?](https://discourse.julialang.org/t/why-isnt-pointer-cint-0-valid/7654)

<div class="topic-metadata">

**Author:** [@standarddeviant](https://discourse.julialang.org/u/standarddeviant)\
**Replies:** 2\
**Last updated:** [December 9, 2017, 6:01pm UTC](https://discourse.julialang.org/t/why-isnt-pointer-cint-0-valid/7654 "2017-12-09T18:01:21Z")

</div>

I’m trying to wrap a library with ccall. The following yields an error: a = Cint(0) p = pointer(a) But this works and I think does what I want: a = Vector{Cint}(1); a\[1\]=0; p = pointer(a) But it feels awfully silly …

---

## [LoadError: TypeError: Type{...} expression: expected UnionAll, got TypeVar](https://discourse.julialang.org/t/loaderror-typeerror-type-expression-expected-unionall-got-typevar/7646)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 2\
**Last updated:** [December 9, 2017, 5:56pm UTC](https://discourse.julialang.org/t/loaderror-typeerror-type-expression-expected-unionall-got-typevar/7646 "2017-12-09T17:56:43Z")

</div>

Hi everyone, I was writing an Option Monad, and this is what i get from the following line: m\_join{T1\<:Option,T2\<:Option,T}(x::T1{T2{T}}) = get(None{T}(),x) and structure of Option is as follows: abstract type Op…

---

## [What's the fastest way to generate \`\[1,2,....,n\]\`?](https://discourse.julialang.org/t/whats-the-fastest-way-to-generate-1-2-n/7564)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 16\
**Last updated:** [December 8, 2017, 6:51pm UTC](https://discourse.julialang.org/t/whats-the-fastest-way-to-generate-1-2-n/7564 "2017-12-08T18:51:52Z")

</div>

For an algorithm I need to generate x = \[1,2,...,n\] for a large n and I can’t do x = 1:n as I need to reassign the values in x so I can do something like x\[10\] = x\[2\]. Currently I am doing x=collect(1:n) and I tested x …

---

## [Git help: how to edit an older release of a package](https://discourse.julialang.org/t/git-help-how-to-edit-an-older-release-of-a-package/7627)

<div class="topic-metadata">

**Author:** [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Replies:** 3\
**Last updated:** [December 8, 2017, 5:19pm UTC](https://discourse.julialang.org/t/git-help-how-to-edit-an-older-release-of-a-package/7627 "2017-12-08T17:19:04Z")

</div>

I’ve forgotten (or I might not ever have known) how to git-edit an older release of a package without affecting anything else. I’ve got these releases and tags: I want to edit v0.9.2 to make it work on Julia v0.5. (I…

---

## [Bug with isapprox?](https://discourse.julialang.org/t/bug-with-isapprox/7600)

<div class="topic-metadata">

**Author:** [@harven](https://discourse.julialang.org/u/harven)\
**Replies:** 6\
**Last updated:** [December 8, 2017, 4:40am UTC](https://discourse.julialang.org/t/bug-with-isapprox/7600 "2017-12-08T04:40:24Z")

</div>

Hi all, I don’t understand the behavior of isapprox. julia\> -3.03664471426105e-17 ≈ 0.0 false julia\> 1.0 - 3.03664471426105e-17 ≈ 1.0 - 0.0 true Can someone reproduce/explain what looks like a bug here?

---

## [Help understanding allocation on scalar function and possible ways to avoid it](https://discourse.julialang.org/t/help-understanding-allocation-on-scalar-function-and-possible-ways-to-avoid-it/7614)

<div class="topic-metadata">

**Author:** [@favba](https://discourse.julialang.org/u/favba)\
**Replies:** 3\
**Last updated:** [December 7, 2017, 9:30pm UTC](https://discourse.julialang.org/t/help-understanding-allocation-on-scalar-function-and-possible-ways-to-avoid-it/7614 "2017-12-07T21:30:57Z")

</div>

Can someone kindly explain me why the following function allocates memory? Is there a way to avoid it? On my machine it produces 14 allocations using inputs of Float64s (on Julia 6.1). julia\> using BenchmarkTools juli…

---

## [Updating Cairo.jl for ProfileView.jl](https://discourse.julialang.org/t/updating-cairo-jl-for-profileview-jl/7605)

<div class="topic-metadata">

**Author:** [@rvlander](https://discourse.julialang.org/u/rvlander)\
**Replies:** 3\
**Last updated:** [December 7, 2017, 3:30pm UTC](https://discourse.julialang.org/t/updating-cairo-jl-for-profileview-jl/7605 "2017-12-07T15:30:22Z")

</div>

A recent bug in Cairo.jl incurred the crash of ProfileView.jl. It has been fixed in Cairo. How can I have ProfileView use the fixed version manually? I did not find any detailed doc concerning the way we can interact w…

---

## [Spawn-fetch usage](https://discourse.julialang.org/t/spawn-fetch-usage/7549)

<div class="topic-metadata">

**Author:** [@antonio-ribeiro](https://discourse.julialang.org/u/antonio-ribeiro)\
**Replies:** 16\
**Last updated:** [December 7, 2017, 12:37pm UTC](https://discourse.julialang.org/t/spawn-fetch-usage/7549 "2017-12-07T12:37:18Z")

</div>

Hi all! I am interest in using @spawn and fetch for parallel programing. I am getting some outputs that are not exactly what I would expect from the tutorial. I would be grateful if someone could point out to me if I am…

---

## [Are there tricks to reduce compile-time for this code?](https://discourse.julialang.org/t/are-there-tricks-to-reduce-compile-time-for-this-code/7596)

<div class="topic-metadata">

**Author:** [@saschatimme](https://discourse.julialang.org/u/saschatimme)\
**Replies:** 4\
**Last updated:** [December 7, 2017, 10:47am UTC](https://discourse.julialang.org/t/are-there-tricks-to-reduce-compile-time-for-this-code/7596 "2017-12-07T10:47:12Z")

</div>

I am exploring to use generated function for the evaluation of multivariate polynomials and I am all in all very pleased with the results I get. The only problem is that for larger polynomials the compile time can get qu…

---

## [Grouping multiple varargs by type](https://discourse.julialang.org/t/grouping-multiple-varargs-by-type/7597)

<div class="topic-metadata">

**Author:** [@louisponet](https://discourse.julialang.org/u/louisponet)\
**Replies:** 3\
**Last updated:** [December 7, 2017, 10:00am UTC](https://discourse.julialang.org/t/grouping-multiple-varargs-by-type/7597 "2017-12-07T10:00:29Z")

</div>

I was wondering if this is possible with the base julia features, something along the lines of function foo(f\_args:T... , i\_args::R...) where {T\<: AbstractFloat, R\<: Int} . I understand that this is not necessary since …

---

## [Best practices for specifying return type](https://discourse.julialang.org/t/best-practices-for-specifying-return-type/7595)

<div class="topic-metadata">

**Author:** [@louisponet](https://discourse.julialang.org/u/louisponet)\
**Replies:** 5\
**Last updated:** [December 7, 2017, 9:29am UTC](https://discourse.julialang.org/t/best-practices-for-specifying-return-type/7595 "2017-12-07T09:29:06Z")

</div>

Is there a “best practice” for defining the return type of for example a file reading function? There used to be the option to explicitly define a parametric type of a function, something like read\_file{Float64}(....) u…

---

## [Inconsistent (unexpected?) behavior in elementwise operators](https://discourse.julialang.org/t/inconsistent-unexpected-behavior-in-elementwise-operators/7560)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 6\
**Last updated:** [December 7, 2017, 8:35am UTC](https://discourse.julialang.org/t/inconsistent-unexpected-behavior-in-elementwise-operators/7560 "2017-12-07T08:35:13Z")

</div>

I have a ratings variable: ratings = 10×3 DataFrames.DataFrame │ Row │ Movie title │ Dean │ Sam │ ├─────┼─────────────────────────────────────┼──────┼─────┤ │ 1 │ "Moonlight (2016)" …

---

## [Is anyone using v0.7 on Windows10?](https://discourse.julialang.org/t/is-anyone-using-v0-7-on-windows10/7563)

<div class="topic-metadata">

**Author:** [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Replies:** 6\
**Last updated:** [December 7, 2017, 7:26am UTC](https://discourse.julialang.org/t/is-anyone-using-v0-7-on-windows10/7563 "2017-12-07T07:26:14Z")

</div>

As I read a date of December 15 somewhere (for an alpha version or something similar) I thought I could start looking into v0.7 today (irrespective whether that date will be met or not) Besides a number of build errors …

---

## [How to override "." for field access?](https://discourse.julialang.org/t/how-to-override-for-field-access/7593)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 2\
**Last updated:** [December 7, 2017, 6:53am UTC](https://discourse.julialang.org/t/how-to-override-for-field-access/7593 "2017-12-07T06:53:08Z")

</div>

Hi, I want to override . for accessing fields. How should i do that? Thanks

---

## [iCalendar Julia library](https://discourse.julialang.org/t/icalendar-julia-library/7580)

<div class="topic-metadata">

**Author:** [@scelles](https://discourse.julialang.org/u/scelles)\
**Replies:** 2\
**Last updated:** [December 7, 2017, 6:16am UTC](https://discourse.julialang.org/t/icalendar-julia-library/7580 "2017-12-07T06:16:16Z")

</div>

Hello, I’m looking for a Julia library to parse and generate icalendar files comparable to icalendar https://github.com/collective/icalendar ics https://github.com/C4ptainCrunch/ics.py Unfortunately I haven’t found…

---

## [Is an explicit "export" a good thing?](https://discourse.julialang.org/t/is-an-explicit-export-a-good-thing/7446)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 51\
**Last updated:** [December 7, 2017, 3:11am UTC](https://discourse.julialang.org/t/is-an-explicit-export-a-good-thing/7446 "2017-12-07T03:11:26Z")

</div>

I am beginning to have doubts about the wisdom of using “export” in modules. When the modules get "using"ed (could we change this keyword please to “use” instead of “using”?), for someone coming to a finished code it may…

---

## [Is QuantLib.jl still under development?](https://discourse.julialang.org/t/is-quantlib-jl-still-under-development/7579)

<div class="topic-metadata">

**Author:** [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Replies:** 2\
**Last updated:** [December 6, 2017, 8:50pm UTC](https://discourse.julialang.org/t/is-quantlib-jl-still-under-development/7579 "2017-12-06T20:50:26Z")

</div>

I have been using QuantLib and RQuantLib for some time, and I noticed that QuantLib.jl is available in GitHub, but I am not sure if it is still under development. At the same time, I checked some of the other quant pack…

---

## [Re-use Base function name in a module?](https://discourse.julialang.org/t/re-use-base-function-name-in-a-module/7575)

<div class="topic-metadata">

**Author:** [@ggggggggg](https://discourse.julialang.org/u/ggggggggg)\
**Replies:** 1\
**Last updated:** [December 6, 2017, 6:16pm UTC](https://discourse.julialang.org/t/re-use-base-function-name-in-a-module/7575 "2017-12-06T18:16:40Z")

</div>

Consider creating a module A with a function called split inside of it. Then I can call the function as A.split without clobbering or extending Base.split, so it could have a different meaning. Within A I would have to q…

---

## [Is there a way to "forward" getindex for Tuples in a type-stable way?](https://discourse.julialang.org/t/is-there-a-way-to-forward-getindex-for-tuples-in-a-type-stable-way/2889)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 25\
**Last updated:** [December 6, 2017, 5:44pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-forward-getindex-for-tuples-in-a-type-stable-way/2889 "2017-12-06T17:44:38Z")

</div>

I have some data structure which has a field which is a Tuple, and I want to forward getindex called on my data structure to this tuple, while maintaining type stability. From what I can tell, there is some magic happeni…

---

## [JuliaBox.com reset work directory](https://discourse.julialang.org/t/juliabox-com-reset-work-directory/7512)

<div class="topic-metadata">

**Author:** [@gaomrx](https://discourse.julialang.org/u/gaomrx)\
**Replies:** 2\
**Last updated:** [December 6, 2017, 5:44pm UTC](https://discourse.julialang.org/t/juliabox-com-reset-work-directory/7512 "2017-12-06T17:44:08Z")

</div>

I logged out of JuliaBox.com a few hours ago and when I signed in again, everything in my work folder was gone. Not sure what happened in between and would really like to know how to get back my files. I had sync most of…

---

## [Predicate for checking wider subtype of \`Integer\`](https://discourse.julialang.org/t/predicate-for-checking-wider-subtype-of-integer/7566)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 3\
**Last updated:** [December 6, 2017, 1:20pm UTC](https://discourse.julialang.org/t/predicate-for-checking-wider-subtype-of-integer/7566 "2017-12-06T13:20:00Z")

</div>

If T \<: Integer and S \<: Integer, how can I check that S is (weakly) wider than T? Comparing typemax and typemin does not work because of BigInt. I could special-case BigInt, but then I would miss similar user-defined t…

---

## [Linspace with DateTime](https://discourse.julialang.org/t/linspace-with-datetime/7565)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 0\
**Last updated:** [December 6, 2017, 12:44pm UTC](https://discourse.julialang.org/t/linspace-with-datetime/7565 "2017-12-06T12:44:38Z")

</div>

I wanted to create a linearly spaced range of DateTimes, but: julia\> linspace(DateTime(0), now(), 5) 5-element LinSpace{DateTime}: Error showing value of type LinSpace{DateTime}: ERROR: MethodError: no method matching \*…

---

## [What is the difference between \`Threads.@threads' and \`Threads@threads'?](https://discourse.julialang.org/t/what-is-the-difference-between-threads-threads-and-threads-threads/7558)

<div class="topic-metadata">

**Author:** [@alirezamecheng](https://discourse.julialang.org/u/alirezamecheng)\
**Replies:** 6\
**Last updated:** [December 6, 2017, 10:36am UTC](https://discourse.julialang.org/t/what-is-the-difference-between-threads-threads-and-threads-threads/7558 "2017-12-06T10:36:20Z")

</div>

Hello. I’m wondering what is the difference between Threads.@threads and Threads@threads? for example in : Threads.@threads for i=1:N A\[i\] = i end Thank you.

---

## [Allocations in large function](https://discourse.julialang.org/t/allocations-in-large-function/7559)

<div class="topic-metadata">

**Author:** [@saschatimme](https://discourse.julialang.org/u/saschatimme)\
**Replies:** 2\
**Last updated:** [December 6, 2017, 10:09am UTC](https://discourse.julialang.org/t/allocations-in-large-function/7559 "2017-12-06T10:09:19Z")

</div>

I am playing around with code generation for the evaluation of multivariate polynomials and hit a problem which I do not completely understand. The problem is already ocurring for the following function function strange…

---

## [How to leverage internals of \`collect\`](https://discourse.julialang.org/t/how-to-leverage-internals-of-collect/7493)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 8\
**Last updated:** [December 6, 2017, 10:00am UTC](https://discourse.julialang.org/t/how-to-leverage-internals-of-collect/7493 "2017-12-06T10:00:42Z")

</div>

As part of on API I am working on, one of the higher-level functions collects results from an iterative algorithm. The results use user-defined functions, which are ideally type stable, but don’t have to be. Code could l…

---

## [Runtime Currying / Runtime Partial Functions](https://discourse.julialang.org/t/runtime-currying-runtime-partial-functions/7555)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 1\
**Last updated:** [December 6, 2017, 7:11am UTC](https://discourse.julialang.org/t/runtime-currying-runtime-partial-functions/7555 "2017-12-06T07:11:10Z")

</div>

Hi, Is there a package or some construct in Julia, which provides partial functions? Thanks

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

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