# General Usage

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

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

**Page:** 1067

---

## [Type-inferable interleave two tuples](https://discourse.julialang.org/t/type-inferable-interleave-two-tuples/1805)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [February 1, 2017, 10:01am UTC](https://discourse.julialang.org/t/type-inferable-interleave-two-tuples/1805 "2017-02-01T10:01:24Z")

</div>

I am working through the 18.S096 course. In lecture 3, an exercise is Write a type-inferable function to… interleave the elements of two tuples Is this an OK solution? \_il(bs,a,arest...) = (a,\_il(arest,bs...)...) \_i…

---

## [Missingness versus Undefinedness](https://discourse.julialang.org/t/missingness-versus-undefinedness/1804)

<div class="topic-metadata">

**Author:** [@philip](https://discourse.julialang.org/u/philip)\
**Replies:** 6\
**Last updated:** [February 1, 2017, 4:24am UTC](https://discourse.julialang.org/t/missingness-versus-undefinedness/1804 "2017-02-01T04:24:19Z")

</div>

Has anyone in the Julia community tackled the issue of distinguishing missing data from undefined data, e.g. in the design of the DataFrames NA or the generic Nullable, or in some other context? Specifically, I’m thinki…

---

## [Apparently more-specialised method not called](https://discourse.julialang.org/t/apparently-more-specialised-method-not-called/1811)

<div class="topic-metadata">

**Author:** [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Replies:** 2\
**Last updated:** [February 1, 2017, 1:00am UTC](https://discourse.julialang.org/t/apparently-more-specialised-method-not-called/1811 "2017-02-01T01:00:24Z")

</div>

I don’t understand the following behaviour: julia\> f(x::Real, y::Real) = x+y f (generic function with 1 method) julia\> f(x::T, y::T) where T = x - y # 0.6 syntax; on 0.5 would be f{T}(x::T, y::T) = x - y f (generi…

---

## [DistributedArrays Issues](https://discourse.julialang.org/t/distributedarrays-issues/1810)

<div class="topic-metadata">

**Author:** [@goldfita](https://discourse.julialang.org/u/goldfita)\
**Replies:** 0\
**Last updated:** [January 31, 2017, 10:34pm UTC](https://discourse.julialang.org/t/distributedarrays-issues/1810 "2017-01-31T22:34:18Z")

</div>

I’m experimenting with DistributedArrays and running into a few minor hiccups (Julia 0.5). The first is that the first time in I include the file with the line @everywhere using DistributedArray, I get four warnings (fo…

---

## [Calling a funcion with tuple types](https://discourse.julialang.org/t/calling-a-funcion-with-tuple-types/1745)

<div class="topic-metadata">

**Author:** [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Replies:** 3\
**Last updated:** [January 31, 2017, 4:29pm UTC](https://discourse.julialang.org/t/calling-a-funcion-with-tuple-types/1745 "2017-01-31T16:29:05Z")

</div>

Consider the following: julia\> f{N}(x::Type{NTuple{N,Int}}) = x f (generic function with 1 method) julia\> g{N}(x::Type{NTuple{N,Any}}) = x g (generic function with 1 method) julia\> f(Tuple{Int,Int}) Tuple{Int64,Int64}…

---

## [Line number of calling site](https://discourse.julialang.org/t/line-number-of-calling-site/1785)

<div class="topic-metadata">

**Author:** [@TsurHerman](https://discourse.julialang.org/u/TsurHerman)\
**Replies:** 4\
**Last updated:** [January 31, 2017, 2:44pm UTC](https://discourse.julialang.org/t/line-number-of-calling-site/1785 "2017-01-31T14:44:47Z")

</div>

Is there a way to get the line number of the calling function? I would like to encode the filename and the line number of a type. so for example if I have type foo line::Int32 fname::String end what should b…

---

## [Line breaks in comprehension syntax](https://discourse.julialang.org/t/line-breaks-in-comprehension-syntax/1800)

<div class="topic-metadata">

**Author:** [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Replies:** 3\
**Last updated:** [January 31, 2017, 2:42pm UTC](https://discourse.julialang.org/t/line-breaks-in-comprehension-syntax/1800 "2017-01-31T14:42:30Z")

</div>

The following gives a syntax error, is this intended? It seems to me as the most natural way to break long comprehensions into several lines: x = randn(100) \[x\[i\] for i in 1:100 if x\[i\] \< 0.5\] syntax: expected "\]"

---

## [Sparse matrix multiplication complexity](https://discourse.julialang.org/t/sparse-matrix-multiplication-complexity/1776)

<div class="topic-metadata">

**Author:** [@WenlongGong](https://discourse.julialang.org/u/WenlongGong)\
**Replies:** 2\
**Last updated:** [January 30, 2017, 11:45pm UTC](https://discourse.julialang.org/t/sparse-matrix-multiplication-complexity/1776 "2017-01-30T23:45:25Z")

</div>

I’m trying to confirm the spmatmul() function in julia, for sparse matrix multiplication, has the same complexity (using big O notation) with Matlab sparse matrix multiplication(by Dr. Tim Davis). For A\*B, A is m by n, …

---

## [How to "unset" entries in sparse array?](https://discourse.julialang.org/t/how-to-unset-entries-in-sparse-array/1793)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 1\
**Last updated:** [January 30, 2017, 11:13pm UTC](https://discourse.julialang.org/t/how-to-unset-entries-in-sparse-array/1793 "2017-01-30T23:13:23Z")

</div>

Consider this example: x = spzeros(5,5) x\[1,1\] = 1.0 x\[1,1\] = 0.0 Now x holds the entry at 1,1, although it is zero: julia\> x 5×5 sparse matrix with 1 Float64 nonzero entries: \[1, 1\] = 0.0 How can I make x “forget…

---

## [Method definition overwritten warning for functions with default arguments](https://discourse.julialang.org/t/method-definition-overwritten-warning-for-functions-with-default-arguments/1710)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 30\
**Last updated:** [January 30, 2017, 10:54pm UTC](https://discourse.julialang.org/t/method-definition-overwritten-warning-for-functions-with-default-arguments/1710 "2017-01-30T22:54:41Z")

</div>

When defining multiple methods of the same function using default arguments, Julia generates extra methods to handle the syntactic sugar. But it can so happen that Julia will define the same methods for each of the metho…

---

## [Help with Optim tests on nightlies](https://discourse.julialang.org/t/help-with-optim-tests-on-nightlies/1783)

<div class="topic-metadata">

**Author:** [@pkofod](https://discourse.julialang.org/u/pkofod)\
**Replies:** 0\
**Last updated:** [January 30, 2017, 12:37pm UTC](https://discourse.julialang.org/t/help-with-optim-tests-on-nightlies/1783 "2017-01-30T12:37:59Z")

</div>

I have a problem with Optim, and I’m not exactly sure how to debug it. On master I get the following log ( https://s3.amazonaws.com/archive.travis-ci.org/jobs/196382616/log.txt , warning it’s a 3mb stack trace) when tryi…

---

## [Build a UnionAll from C](https://discourse.julialang.org/t/build-a-unionall-from-c/1729)

<div class="topic-metadata">

**Author:** [@barche](https://discourse.julialang.org/u/barche)\
**Replies:** 1\
**Last updated:** [January 30, 2017, 11:20am UTC](https://discourse.julialang.org/t/build-a-unionall-from-c/1729 "2017-01-30T11:20:17Z")

</div>

Prior to 0.6, I constructed parametric types with jl\_new\_datatype and setting a list of parameters. Then a concrete instantiation of the type could be set using jl\_apply\_type. In 0.6, however, the latter seems to expect …

---

## [Where are the docs for the DataFrames by() function](https://discourse.julialang.org/t/where-are-the-docs-for-the-dataframes-by-function/1775)

<div class="topic-metadata">

**Author:** [@DWSchulze](https://discourse.julialang.org/u/DWSchulze)\
**Replies:** 3\
**Last updated:** [January 29, 2017, 11:21pm UTC](https://discourse.julialang.org/t/where-are-the-docs-for-the-dataframes-by-function/1775 "2017-01-29T23:21:55Z")

</div>

I can’t find any docs for the by() function in DataFrames. There is an example of usage here, but no docs: http://dataframesjl.readthedocs.io/en/latest/reshaping\_and\_pivoting.html?highlight=by

---

## [Showing full stacktrace on error in the repl](https://discourse.julialang.org/t/showing-full-stacktrace-on-error-in-the-repl/1767)

<div class="topic-metadata">

**Author:** [@nbren12](https://discourse.julialang.org/u/nbren12)\
**Replies:** 2\
**Last updated:** [January 29, 2017, 7:21pm UTC](https://discourse.julialang.org/t/showing-full-stacktrace-on-error-in-the-repl/1767 "2017-01-29T19:21:22Z")

</div>

Is there some way to show the full stacktrace when an error happens in the REPL? An example error is ERROR: MethodError: no method matching to\_shape(::Tuple{XArray.Axis,XArray.Axis}) Closest candidates are: to\_shape(:…

---

## [How do I offset the origin of one axis in PyPlot Plot3D](https://discourse.julialang.org/t/how-do-i-offset-the-origin-of-one-axis-in-pyplot-plot3d/1757)

<div class="topic-metadata">

**Author:** [@phillefjonk](https://discourse.julialang.org/u/phillefjonk)\
**Replies:** 1\
**Last updated:** [January 29, 2017, 4:32pm UTC](https://discourse.julialang.org/t/how-do-i-offset-the-origin-of-one-axis-in-pyplot-plot3d/1757 "2017-01-29T16:32:03Z")

</div>

I am doing a 3D plot with Plot3D using PyPlot \< code that computes x1, x2, x3 \> plot3D(x1,x2,x3) xlim(6378237-1000,6378237+1000) ylim(-1000,1000) zlim(0,1000) Instead of setting the limits of the x-axis with xlim() I…

---

## [Switch between Julia kernels in Atom/Juno](https://discourse.julialang.org/t/switch-between-julia-kernels-in-atom-juno/1760)

<div class="topic-metadata">

**Author:** [@mik](https://discourse.julialang.org/u/mik)\
**Replies:** 0\
**Last updated:** [January 29, 2017, 1:26pm UTC](https://discourse.julialang.org/t/switch-between-julia-kernels-in-atom-juno/1760 "2017-01-29T13:26:40Z")

</div>

Is there a way to switch between multiple Julia kernels from within Atom? I know Atom can spawn a new Julia session (Julia \> Start Julia) and stop/interrupt a running session. But I’d like to be able to “step into” an ex…

---

## [Removing ambiguity warnings from Julia v0.4](https://discourse.julialang.org/t/removing-ambiguity-warnings-from-julia-v0-4/1748)

<div class="topic-metadata">

**Author:** [@kevin.squire](https://discourse.julialang.org/u/kevin.squire)\
**Replies:** 2\
**Last updated:** [January 29, 2017, 6:10am UTC](https://discourse.julialang.org/t/removing-ambiguity-warnings-from-julia-v0-4/1748 "2017-01-29T06:10:06Z")

</div>

I’m updating the SortedSet constructors in DataStructures.jl, and I’m having trouble removing a particular ambiguity warning from Julia v0.4. The code works fine in v0.5 and v0.6 (and not just because ambiguity warnings…

---

## [Difference between "using" and "include"?](https://discourse.julialang.org/t/difference-between-using-and-include/1739)

<div class="topic-metadata">

**Author:** [@phillefjonk](https://discourse.julialang.org/u/phillefjonk)\
**Replies:** 4\
**Last updated:** [January 29, 2017, 3:09am UTC](https://discourse.julialang.org/t/difference-between-using-and-include/1739 "2017-01-29T03:09:52Z")

</div>

The documentation on Modules and the usage of “using” vs “include” is a not crystal clear I think. I have a main Julia script and three scripts in separate .jl files (in the same directory). main.jl include("script1…

---

## [Need help with Reactive possible bug?](https://discourse.julialang.org/t/need-help-with-reactive-possible-bug/1722)

<div class="topic-metadata">

**Author:** [@TsurHerman](https://discourse.julialang.org/u/TsurHerman)\
**Replies:** 1\
**Last updated:** [January 28, 2017, 7:28pm UTC](https://discourse.julialang.org/t/need-help-with-reactive-possible-bug/1722 "2017-01-28T19:28:26Z")

</div>

In a project I am working on, I have a situation where the logic is very elegantly expressed using Reactive programming… Basically I have a signal that I need to respond to , that signal undergoes 3 different transform…

---

## [Create a Dict from eltype](https://discourse.julialang.org/t/create-a-dict-from-eltype/1742)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 4\
**Last updated:** [January 28, 2017, 6:47pm UTC](https://discourse.julialang.org/t/create-a-dict-from-eltype/1742 "2017-01-28T18:47:31Z")

</div>

Is there a reason why dict cannot be constructed from its element type eltype(d)=Pair{K,V} but requires to pass key and value types? The constructor for a dict from its element type is similar(d, eltype(d)). For a vecto…

---

## [PyPlot Crash](https://discourse.julialang.org/t/pyplot-crash/1706)

<div class="topic-metadata">

**Author:** [@goldfita](https://discourse.julialang.org/u/goldfita)\
**Replies:** 13\
**Last updated:** [January 28, 2017, 6:14pm UTC](https://discourse.julialang.org/t/pyplot-crash/1706 "2017-01-28T18:14:24Z")

</div>

The following stem plot takes around half a minute to execute, all the while the REPL is blocked. I thought either PyPlot was supposed to automatically run plotting asynchronously in the background or at least there is …

---

## [Passing Arrays to embedded Julia](https://discourse.julialang.org/t/passing-arrays-to-embedded-julia/1730)

<div class="topic-metadata">

**Author:** [@McC0dy](https://discourse.julialang.org/u/McC0dy)\
**Replies:** 5\
**Last updated:** [January 28, 2017, 4:50am UTC](https://discourse.julialang.org/t/passing-arrays-to-embedded-julia/1730 "2017-01-28T04:50:23Z")

</div>

I’m currently attempting to call Julia base functions from C# using the ‘julia.h’ and ‘libjulia.dll’ and I’m getting stuck when passing an array as a function argument. Maybe 1 of you can help? I can call functions from…

---

## [@test\_warn, @test\_nowarn, and @test\_nothrow](https://discourse.julialang.org/t/test-warn-test-nowarn-and-test-nothrow/1700)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 6\
**Last updated:** [January 27, 2017, 10:54pm UTC](https://discourse.julialang.org/t/test-warn-test-nowarn-and-test-nothrow/1700 "2017-01-27T22:54:20Z")

</div>

Is there a way to test for warning throws? Like @test\_throws does for exceptions. Additionally, I would like tests that pass if a given code does not throw a Warning or an Exception. That is, I would also like a @test\_d…

---

## [Benchmark showing 2x slower result between nearly identical functions on Julia 0.6](https://discourse.julialang.org/t/benchmark-showing-2x-slower-result-between-nearly-identical-functions-on-julia-0-6/1721)

<div class="topic-metadata">

**Author:** [@jmert](https://discourse.julialang.org/u/jmert)\
**Replies:** 4\
**Last updated:** [January 27, 2017, 8:22pm UTC](https://discourse.julialang.org/t/benchmark-showing-2x-slower-result-between-nearly-identical-functions-on-julia-0-6/1721 "2017-01-27T20:22:14Z")

</div>

I’ve been doing some performance testing of variations of a math kernel operation, and in doing so, I’ve come across a benchmarking result which sensitively depends on whether a supposedly useless line is included or not…

---

## [X, y = 1, 2, 3 doesn't raise error? Neither does x, = 3](https://discourse.julialang.org/t/x-y-1-2-3-doesnt-raise-error-neither-does-x-3/1716)

<div class="topic-metadata">

**Author:** [@FANG\_Colin](https://discourse.julialang.org/u/FANG_Colin)\
**Replies:** 5\
**Last updated:** [January 27, 2017, 6:41pm UTC](https://discourse.julialang.org/t/x-y-1-2-3-doesnt-raise-error-neither-does-x-3/1716 "2017-01-27T18:41:39Z")

</div>

x, y = 1, 2, 3 behaves the same as x, y = 1, 2 Also x, = 3 behaves the same as x = 3 Are they a feature? In python both would trigger exceptions, which I think is better.

---

## [Juliabox slide show navigation](https://discourse.julialang.org/t/juliabox-slide-show-navigation/1648)

<div class="topic-metadata">

**Author:** [@abieler](https://discourse.julialang.org/u/abieler)\
**Replies:** 7\
**Last updated:** [January 27, 2017, 1:36pm UTC](https://discourse.julialang.org/t/juliabox-slide-show-navigation/1648 "2017-01-27T13:36:50Z")

</div>

I just tested the slide show functionality on Juliabox and could not figure out how to navigate through slides. I have two separate markdown cells, when changing into presentation mode I cannot scroll or switch to the s…

---

## [Quick question: HTTP with REST download from the server?](https://discourse.julialang.org/t/quick-question-http-with-rest-download-from-the-server/1541)

<div class="topic-metadata">

**Author:** [@Martin\_Florek](https://discourse.julialang.org/u/Martin_Florek)\
**Replies:** 6\
**Last updated:** [January 27, 2017, 8:45am UTC](https://discourse.julialang.org/t/quick-question-http-with-rest-download-from-the-server/1541 "2017-01-27T08:45:31Z")

</div>

I would like to know how download data from REST over HTTP protocol with the help of web service with method “POST” and Content-Type: application/xml? Thanks

---

## [Module causing Julia to hang when compiling simple function](https://discourse.julialang.org/t/module-causing-julia-to-hang-when-compiling-simple-function/1679)

<div class="topic-metadata">

**Author:** [@colintbowers](https://discourse.julialang.org/u/colintbowers)\
**Replies:** 12\
**Last updated:** [January 27, 2017, 2:41am UTC](https://discourse.julialang.org/t/module-causing-julia-to-hang-when-compiling-simple-function/1679 "2017-01-27T02:41:28Z")

</div>

Hi all, Julia v0.5 on Ubuntu 16.04. When working in the REPL, I run the following two lines using MyModule f() = error("argh") The first line runs fine, but the second line hangs, ie I just get a flashing cursor and h…

---

## [MethodError: \`take!\` has no method matching take!(::Base.AbstractIOBuffer{Array{UInt8,1}})](https://discourse.julialang.org/t/methoderror-take-has-no-method-matching-take-base-abstractiobuffer-array-uint8-1/1713)

<div class="topic-metadata">

**Author:** [@MYLYRYS](https://discourse.julialang.org/u/MYLYRYS)\
**Replies:** 2\
**Last updated:** [January 26, 2017, 11:39pm UTC](https://discourse.julialang.org/t/methoderror-take-has-no-method-matching-take-base-abstractiobuffer-array-uint8-1/1713 "2017-01-26T23:39:09Z")

</div>

Hello I get this MethodError…Can anybody help me? thanks you

---

## [Add clip() utility function to Base](https://discourse.julialang.org/t/add-clip-utility-function-to-base/1690)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 6\
**Last updated:** [January 26, 2017, 3:19pm UTC](https://discourse.julialang.org/t/add-clip-utility-function-to-base/1690 "2017-01-26T15:19:20Z")

</div>

In Python this is a handy operation on arrays: https://docs.scipy.org/doc/numpy/reference/generated/numpy.clip.html Is there a function in Julia for achieving the same result? If not, can I open an issue on GitHub with…

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

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