# General Usage

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

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

**Page:** 875

---

## [Problem with eltype of a non-numeric Symmetric matrix](https://discourse.julialang.org/t/problem-with-eltype-of-a-non-numeric-symmetric-matrix/23211)

<div class="topic-metadata">

**Author:** [@lhatzis](https://discourse.julialang.org/u/lhatzis)\
**Replies:** 4\
**Last updated:** [April 16, 2019, 10:08pm UTC](https://discourse.julialang.org/t/problem-with-eltype-of-a-non-numeric-symmetric-matrix/23211 "2019-04-16T22:08:48Z")

</div>

Hi everyone, I have defined a custom type to wrap a Python library similarly to what SymPy.jl does. So I will focus on a custom defined for SymPy but essentially the problem is the same for my custom type too. If I def…

---

## [Tunneling algorithm?](https://discourse.julialang.org/t/tunneling-algorithm/23174)

<div class="topic-metadata">

**Author:** [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Replies:** 7\
**Last updated:** [April 16, 2019, 3:54pm UTC](https://discourse.julialang.org/t/tunneling-algorithm/23174 "2019-04-16T15:54:24Z")

</div>

Hi everybody, i’m looking for the existence of the implementation of a tunneling algorithm in julia, or a wrapper to a solver that does that, any ideas?

---

## [Forwarding vs filtering kwargs](https://discourse.julialang.org/t/forwarding-vs-filtering-kwargs/23196)

<div class="topic-metadata">

**Author:** [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Replies:** 4\
**Last updated:** [April 16, 2019, 1:14pm UTC](https://discourse.julialang.org/t/forwarding-vs-filtering-kwargs/23196 "2019-04-16T13:14:30Z")

</div>

When I want to forward kwargs from an API function to various internal dispatched methods I just allow them to have arbitrary kwargs, like so external\_api(x; kw...) = \_internal(x; kw...) \_internal(x::Float64; kw1 = 1, k…

---

## [Package won't update to most recent version](https://discourse.julialang.org/t/package-wont-update-to-most-recent-version/23197)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 8\
**Last updated:** [April 16, 2019, 12:20pm UTC](https://discourse.julialang.org/t/package-wont-update-to-most-recent-version/23197 "2019-04-16T12:20:55Z")

</div>

Hi- I am trying to update a package called MCMCChains to its most recent release version. For some reason, it does not work. The latest version is 0.3.7. (v1.1) pkg\> update Updating registry at \`~/.julia/registries/G…

---

## [Automatically generating boilerplate code](https://discourse.julialang.org/t/automatically-generating-boilerplate-code/23180)

<div class="topic-metadata">

**Author:** [@Adriel](https://discourse.julialang.org/u/Adriel)\
**Replies:** 2\
**Last updated:** [April 16, 2019, 2:44am UTC](https://discourse.julialang.org/t/automatically-generating-boilerplate-code/23180 "2019-04-16T02:44:13Z")

</div>

I have the following repetitive code structure. mutable struct SC011 state::SCBit info::String nin::Int nout::Int SC011() = new(false, "(1-λ₁)/(1-λ₁λ₂)", 2, 1) end Base.broadcastable(g::SC011) = Ref…

---

## [How to implement macro for assign array of arbitrary dims](https://discourse.julialang.org/t/how-to-implement-macro-for-assign-array-of-arbitrary-dims/23130)

<div class="topic-metadata">

**Author:** [@shipengcheng1230](https://discourse.julialang.org/u/shipengcheng1230)\
**Replies:** 6\
**Last updated:** [April 16, 2019, 12:57am UTC](https://discourse.julialang.org/t/how-to-implement-macro-for-assign-array-of-arbitrary-dims/23130 "2019-04-16T00:57:21Z")

</div>

Hello, I would like to do something like d\[:, :, 1\] = some\_array: function foo(d, x) d\[:,:,1\] = x end Then I could write the following macro: macro gen\_foo(index) fun = gensym() quote function $fun…

---

## [How to correctly refer arguments of macro in nested quote?](https://discourse.julialang.org/t/how-to-correctly-refer-arguments-of-macro-in-nested-quote/23144)

<div class="topic-metadata">

**Author:** [@shipengcheng1230](https://discourse.julialang.org/u/shipengcheng1230)\
**Replies:** 5\
**Last updated:** [April 16, 2019, 12:56am UTC](https://discourse.julialang.org/t/how-to-correctly-refer-arguments-of-macro-in-nested-quote/23144 "2019-04-16T00:56:37Z")

</div>

Suppose I just want to do something like f(x, ind) = x\[ind\] = 5.0, I could write a similar macro like this: julia\> macro foo1(data, index) esc(quote $data\[$index\] = 5.0 end) e…

---

## [Interface to wxwidgets?](https://discourse.julialang.org/t/interface-to-wxwidgets/23152)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 7\
**Last updated:** [April 15, 2019, 11:50pm UTC](https://discourse.julialang.org/t/interface-to-wxwidgets/23152 "2019-04-15T23:50:16Z")

</div>

Just how bad would it be to implement this ? It looks like a daunting task. However there is a complete, very mature, python interface and I was kind of hoping that the work done there might make it more tractable. ho…

---

## [Average Number of Days (Convert Type Day to Number?)](https://discourse.julialang.org/t/average-number-of-days-convert-type-day-to-number/23172)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 3\
**Last updated:** [April 15, 2019, 9:33pm UTC](https://discourse.julialang.org/t/average-number-of-days-convert-type-day-to-number/23172 "2019-04-15T21:33:23Z")

</div>

Hello Julia Community, I have an array of elements of type Day, and when attempting to compute the mean of that array with mean(my\_array\_full\_of\_days), I get an InexactError because the result is a Float. Sum works just…

---

## [Handling exceptions in C](https://discourse.julialang.org/t/handling-exceptions-in-c/23171)

<div class="topic-metadata">

**Author:** [@kim366](https://discourse.julialang.org/u/kim366)\
**Replies:** 0\
**Last updated:** [April 15, 2019, 7:48pm UTC](https://discourse.julialang.org/t/handling-exceptions-in-c/23171 "2019-04-15T19:48:42Z")

</div>

jl\_checked\_assignment(jl\_get\_binding\_wr(jl\_main\_module, jl\_symbol("Main"), 0), jl\_box\_int64(7)); terminates the program preventing me from checking jl\_exception\_occurred(). Only JL\_TRY/JL\_CATCH works. In which case do I …

---

## [Confused about performance interaction between @view and logical (Boolean) indexing](https://discourse.julialang.org/t/confused-about-performance-interaction-between-view-and-logical-boolean-indexing/23120)

<div class="topic-metadata">

**Author:** [@pmags](https://discourse.julialang.org/u/pmags)\
**Replies:** 7\
**Last updated:** [April 15, 2019, 3:28pm UTC](https://discourse.julialang.org/t/confused-about-performance-interaction-between-view-and-logical-boolean-indexing/23120 "2019-04-15T15:28:40Z")

</div>

I’m trying to understand the interaction between array views and Boolean indexing. In general, my understanding (and experience thus far) is that views generally increasing performance when you’re not modifying the arra…

---

## [Read JSON file while interpolate a string](https://discourse.julialang.org/t/read-json-file-while-interpolate-a-string/23163)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 1\
**Last updated:** [April 15, 2019, 3:20pm UTC](https://discourse.julialang.org/t/read-json-file-while-interpolate-a-string/23163 "2019-04-15T15:20:37Z")

</div>

Hi. Suppose I have a .JSON file like the following. { "path": "$dir/movies" } The julia code is like the following: using LazyJSON strJSONFl = String(read("myFile.json")) v = LazyJSON.parse(strJSONFl) dir = @\_\_D…

---

## [Cyclic pair iterator?](https://discourse.julialang.org/t/cyclic-pair-iterator/23156)

<div class="topic-metadata">

**Author:** [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Replies:** 4\
**Last updated:** [April 15, 2019, 3:18pm UTC](https://discourse.julialang.org/t/cyclic-pair-iterator/23156 "2019-04-15T15:18:27Z")

</div>

Hi, I am not very familiar with iterators, so maybe someone can give me some hints. I would like to build a consecutive pairs iterator that would take a collection C and return an iterator over the consecutive pairs. …

---

## [Base.show method for showing a widget in Jupyter](https://discourse.julialang.org/t/base-show-method-for-showing-a-widget-in-jupyter/22099)

<div class="topic-metadata">

**Author:** [@giordano](https://discourse.julialang.org/u/giordano)\
**Replies:** 9\
**Last updated:** [April 15, 2019, 1:22pm UTC](https://discourse.julialang.org/t/base-show-method-for-showing-a-widget-in-jupyter/22099 "2019-04-15T13:22:39Z")

</div>

Is there a way to have different methods for Base.show, one for the REPL and another one only for showing a Widgets.Widget in Jupyter? For example: module Foos using Interact export Foo, foo struct Foo end # This m…

---

## [Function created by factory function](https://discourse.julialang.org/t/function-created-by-factory-function/23154)

<div class="topic-metadata">

**Author:** [@asprionj](https://discourse.julialang.org/u/asprionj)\
**Replies:** 3\
**Last updated:** [April 15, 2019, 8:13am UTC](https://discourse.julialang.org/t/function-created-by-factory-function/23154 "2019-04-15T08:13:59Z")

</div>

I have a type of which I want to create specific instances. To illustrate why I want this, think of a Car with fields model::String, year::Int, acceleration::Function. So there’s some “identifier” fields, some “parameter…

---

## [Copy and collect slow on QRCompactWYQ](https://discourse.julialang.org/t/copy-and-collect-slow-on-qrcompactwyq/23145)

<div class="topic-metadata">

**Author:** [@danspielman](https://discourse.julialang.org/u/danspielman)\
**Replies:** 1\
**Last updated:** [April 14, 2019, 9:47pm UTC](https://discourse.julialang.org/t/copy-and-collect-slow-on-qrcompactwyq/23145 "2019-04-14T21:47:31Z")

</div>

The functions copy and collect are extremely slow on the results of a QR factorization. Matrix produces the same result, but is much faster. An easy solution is to not use copy or collect. Is there a good reason for t…

---

## [Issue with Documenter's pdf output - pictures not found](https://discourse.julialang.org/t/issue-with-documenters-pdf-output-pictures-not-found/23023)

<div class="topic-metadata">

**Author:** [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Replies:** 15\
**Last updated:** [April 14, 2019, 3:07pm UTC](https://discourse.julialang.org/t/issue-with-documenters-pdf-output-pictures-not-found/23023 "2019-04-14T15:07:33Z")

</div>

I’m using Documenter.jl to create documentation for a non-julia project. Creating the website works fine, but I can’t make a pdf with the docker image. If I understand correctly, LaTeXWriter misses the pictures. Julia e…

---

## [Arpack puzzles: ask the maintainers?](https://discourse.julialang.org/t/arpack-puzzles-ask-the-maintainers/23082)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 10\
**Last updated:** [April 14, 2019, 1:54pm UTC](https://discourse.julialang.org/t/arpack-puzzles-ask-the-maintainers/23082 "2019-04-14T13:54:02Z")

</div>

I use Arpack in the shift-invert mode for the generalized eigenvalue problem. I try to set the maximum number of iterations and/or the tolerance, but both parameters appear to be ignored. Does anyone know who actually ac…

---

## [Function accepting a parametric function](https://discourse.julialang.org/t/function-accepting-a-parametric-function/23106)

<div class="topic-metadata">

**Author:** [@Alan\_Bahm](https://discourse.julialang.org/u/Alan_Bahm)\
**Replies:** 2\
**Last updated:** [April 14, 2019, 1:11pm UTC](https://discourse.julialang.org/t/function-accepting-a-parametric-function/23106 "2019-04-14T13:11:58Z")

</div>

Hi all, I am trying to port some code I inherited from Julia 0.6 (via Julia 0.7) into Julia v1.1. The code below worked in v0.6, but errors in v1.1. The approach/syntax is outside of my understanding, in fact I have t…

---

## [How to to a DataFrame of DataFrames](https://discourse.julialang.org/t/how-to-to-a-dataframe-of-dataframes/22885)

<div class="topic-metadata">

**Author:** [@steph\_de\_paris](https://discourse.julialang.org/u/steph_de_paris)\
**Replies:** 3\
**Last updated:** [April 14, 2019, 12:08pm UTC](https://discourse.julialang.org/t/how-to-to-a-dataframe-of-dataframes/22885 "2019-04-14T12:08:58Z")

</div>

I need to to a DataFramce of DataFrames. When I use dh=\[DataFrame(a=1,b=1);DataFrame(a=1,b=1)\] it is OK since dh is a DataFrame. Indeed, I obtain this DataFrame: 2 rows × 2 columns a b Int64 Int64 1 1 1 2 1 1 Ne…

---

## [Difference between jl\_get\_binding and jl\_module\_globalref](https://discourse.julialang.org/t/difference-between-jl-get-binding-and-jl-module-globalref/23134)

<div class="topic-metadata">

**Author:** [@kim366](https://discourse.julialang.org/u/kim366)\
**Replies:** 0\
**Last updated:** [April 14, 2019, 11:05am UTC](https://discourse.julialang.org/t/difference-between-jl-get-binding-and-jl-module-globalref/23134 "2019-04-14T11:05:59Z")

</div>

Hello, I am again a little lost in the masses of the Julia source code. I have found the functions jl\_get\_binding and jl\_module\_globalref and I am a little confused about their difference. The latter does not return a b…

---

## [Type hierarchy for TSP instances?](https://discourse.julialang.org/t/type-hierarchy-for-tsp-instances/23123)

<div class="topic-metadata">

**Author:** [@evanfields](https://discourse.julialang.org/u/evanfields)\
**Replies:** 2\
**Last updated:** [April 14, 2019, 10:41am UTC](https://discourse.julialang.org/t/type-hierarchy-for-tsp-instances/23123 "2019-04-14T10:41:54Z")

</div>

It’s time to give my neglected Traveling Salesman problem package some attention. One of the biggest issues: right now, all TSP problem instances are specified by a dense distance matrix, and no heuristics take advantage…

---

## [Filter and reorder pairs of elements?](https://discourse.julialang.org/t/filter-and-reorder-pairs-of-elements/23128)

<div class="topic-metadata">

**Author:** [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Replies:** 2\
**Last updated:** [April 14, 2019, 8:53am UTC](https://discourse.julialang.org/t/filter-and-reorder-pairs-of-elements/23128 "2019-04-14T08:53:24Z")

</div>

Hi everybody, this is an algorithmic problem: i have a set of pairs of elements, from the same group,the members of the group are integers, the first member of a pair is an element of the group, and the second one is a …

---

## [Fast way to evaluate arithmetic and logical expressions at run time](https://discourse.julialang.org/t/fast-way-to-evaluate-arithmetic-and-logical-expressions-at-run-time/23102)

<div class="topic-metadata">

**Author:** [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Replies:** 12\
**Last updated:** [April 13, 2019, 9:27pm UTC](https://discourse.julialang.org/t/fast-way-to-evaluate-arithmetic-and-logical-expressions-at-run-time/23102 "2019-04-13T21:27:54Z")

</div>

I have some expressions generated at run time, for example, :(3.4 - 1.0 \> 1.2 - 1.4^2) and :(2.3^4 - 3.4^3 + 1.2^3). They do not involve any symbols, they just deal with numbers. Is there any efficient way to evaluate…

---

## [ArnoldiMethod.jl: kudos!](https://discourse.julialang.org/t/arnoldimethod-jl-kudos/23103)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 5\
**Last updated:** [April 13, 2019, 8:50pm UTC](https://discourse.julialang.org/t/arnoldimethod-jl-kudos/23103 "2019-04-13T20:50:11Z")

</div>

ArnoldiMethod.jl: highly recommended. It does the job accurately and faster than Arpack. And, it is pure Julia! Kudos to Harmen Stoppels! (I can’t find his handle on this forum, but if you know it please link it here.) …

---

## [Makie update multiple arguments simultaneously](https://discourse.julialang.org/t/makie-update-multiple-arguments-simultaneously/22200)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 1\
**Last updated:** [April 13, 2019, 4:17pm UTC](https://discourse.julialang.org/t/makie-update-multiple-arguments-simultaneously/22200 "2019-04-13T16:17:42Z")

</div>

I want to plot lines, which vary over time. I tried the following code: using Makie len = Node(10) sx = lift(randn, len) sy = lift(randn, len) p = Scene() lines!(p, sx, sy) display(p) for i in 10:20 sleep(0.1) …

---

## [Array of functions and allocation](https://discourse.julialang.org/t/array-of-functions-and-allocation/23110)

<div class="topic-metadata">

**Author:** [@Pier](https://discourse.julialang.org/u/Pier)\
**Replies:** 1\
**Last updated:** [April 13, 2019, 2:38pm UTC](https://discourse.julialang.org/t/array-of-functions-and-allocation/23110 "2019-04-13T14:38:43Z")

</div>

I am trying to understand why arrays of functions allocate. See the following example: using BenchmarkTools f1(u,v)=1.0-u-v fv=Array{Function}(undef,1) fv\[1\]=f1 u=0.1 v=0.2 @btime f1($u,$v) 0.001 ns (0 allocations: 0 by…

---

## [Type Reconstruction Question](https://discourse.julialang.org/t/type-reconstruction-question/23092)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 11\
**Last updated:** [April 13, 2019, 2:28pm UTC](https://discourse.julialang.org/t/type-reconstruction-question/23092 "2019-04-13T14:28:21Z")

</div>

Hi, Let’s assume that I have the following definition julia\>abstract type Foo{T,U} end julia\> typ = Foo{Int,Float64} Foo{Int64,Float64} julia\> typ.parameters svec(Int64, Float64) #this is the function I would like t…

---

## [Unregistred Package](https://discourse.julialang.org/t/unregistred-package/23105)

<div class="topic-metadata">

**Author:** [@marouane](https://discourse.julialang.org/u/marouane)\
**Replies:** 1\
**Last updated:** [April 13, 2019, 11:31am UTC](https://discourse.julialang.org/t/unregistred-package/23105 "2019-04-13T11:31:51Z")

</div>

Hello everyone, there is an unregistered package that i’m unable to add it, and this what the terminal shows me: julia (v0.7) pkg\> add https://github.com/duguxy/PolyLib.jl Updating git-repo \`https://github.com/dugux…

---

## [Substitute symbols in expression](https://discourse.julialang.org/t/substitute-symbols-in-expression/23099)

<div class="topic-metadata">

**Author:** [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Replies:** 5\
**Last updated:** [April 13, 2019, 1:11am UTC](https://discourse.julialang.org/t/substitute-symbols-in-expression/23099 "2019-04-13T01:11:04Z")

</div>

Is there any straight way or a function to substitute symbols in an expression? For example: ex = :(x + x^2 + x^3) substitute(ex, :x =\> :y) # yields :(y + y^2 + y^3) substitute(ex, :x =\> 1.5) # yields :(1.5 + 1.5^2 …

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

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