# General Usage

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

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

**Page:** 988

---

## [Interpolate array elements into \`Base.Cartesian.@nif\`](https://discourse.julialang.org/t/interpolate-array-elements-into-base-cartesian-nif/9992)

<div class="topic-metadata">

**Author:** [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Replies:** 1\
**Last updated:** [March 26, 2018, 1:23pm UTC](https://discourse.julialang.org/t/interpolate-array-elements-into-base-cartesian-nif/9992 "2018-03-26T13:23:36Z")

</div>

This is a continuation of my question in Function that creates generated function using interpolation? - #10 by chakravala However, since the original question in that topic is now solved, I have restated my new questio…

---

## [Function that creates generated function using interpolation?](https://discourse.julialang.org/t/function-that-creates-generated-function-using-interpolation/9951)

<div class="topic-metadata">

**Author:** [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Replies:** 7\
**Last updated:** [March 26, 2018, 11:34am UTC](https://discourse.julialang.org/t/function-that-creates-generated-function-using-interpolation/9951 "2018-03-26T11:34:52Z")

</div>

Hi, so I’d like to to create a function that allows me to automate the creation of generated functions. Here is an example of the type of generated function I’d like to create: using Reduce expr = :(x^2) @generated fun…

---

## [Performance degradation after upgrading from 0.5.1 to 0.6.2 -- how to avoid memory allocation?](https://discourse.julialang.org/t/performance-degradation-after-upgrading-from-0-5-1-to-0-6-2-how-to-avoid-memory-allocation/9971)

<div class="topic-metadata">

**Author:** [@jinliangwei](https://discourse.julialang.org/u/jinliangwei)\
**Replies:** 9\
**Last updated:** [March 26, 2018, 9:33am UTC](https://discourse.julialang.org/t/performance-degradation-after-upgrading-from-0-5-1-to-0-6-2-how-to-avoid-memory-allocation/9971 "2018-03-26T09:33:05Z")

</div>

for rating in ratings x\_idx = rating\[1\] + 1 y\_idx = rating\[2\] + 1 rv = rating\[3\] W\_row = W\[:, x\_idx\] H\_row = H\[:, y\_idx\] pred = dot(W\_row, H\_row) diff = rv - pred W\_grad = -2 \* diff …

---

## [\`show\` is too low-level](https://discourse.julialang.org/t/show-is-too-low-level/7531)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 18\
**Last updated:** [March 26, 2018, 6:48am UTC](https://discourse.julialang.org/t/show-is-too-low-level/7531 "2018-03-26T06:48:16Z")

</div>

The printing of tables has been discussed recently, and every time I wonder how many different table-printing implementations, or tree-printing implementations are in the Julia ecosystem. Here is how show works: As a …

---

## [Re-running Documenter.makedocs interactively](https://discourse.julialang.org/t/re-running-documenter-makedocs-interactively/9964)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [March 26, 2018, 6:35am UTC](https://discourse.julialang.org/t/re-running-documenter-makedocs-interactively/9964 "2018-03-26T06:35:56Z")

</div>

While its documentation suggests the julia make.jl workflow, I am wondering if it would be possible to just call the generator function interactively as I keep working on documentation (writing Markdown directly, but als…

---

## [Is broadcast! supposed to work on StaticArrays?](https://discourse.julialang.org/t/is-broadcast-supposed-to-work-on-staticarrays/9977)

<div class="topic-metadata">

**Author:** [@aaowens](https://discourse.julialang.org/u/aaowens)\
**Replies:** 8\
**Last updated:** [March 26, 2018, 2:43am UTC](https://discourse.julialang.org/t/is-broadcast-supposed-to-work-on-staticarrays/9977 "2018-03-26T02:43:10Z")

</div>

julia\> sv = SVector{3}(ones(3)) 3-element StaticArrays.SArray{Tuple{3},Float64,1,3}: 1.0 1.0 1.0 julia\> sv .= sv .+ sv ERROR: setindex!(::StaticArrays.SArray{Tuple{3},Float64,1,3}, value, ::Int) is not defined. Stack…

---

## [Large memory footprint using type dispatch within a loop](https://discourse.julialang.org/t/large-memory-footprint-using-type-dispatch-within-a-loop/9974)

<div class="topic-metadata">

**Author:** [@phrmoy](https://discourse.julialang.org/u/phrmoy)\
**Replies:** 7\
**Last updated:** [March 25, 2018, 11:50pm UTC](https://discourse.julialang.org/t/large-memory-footprint-using-type-dispatch-within-a-loop/9974 "2018-03-25T23:50:58Z")

</div>

Hi there, I am new to Julia and very excited about it. One of the things I have been excited about (other than performance) is the multiple dispatch. So I figured I would eliminate many of jammed zillion of if-else sta…

---

## [Trying to switch from sympy](https://discourse.julialang.org/t/trying-to-switch-from-sympy/9927)

<div class="topic-metadata">

**Author:** [@EvilPictureBook](https://discourse.julialang.org/u/EvilPictureBook)\
**Replies:** 12\
**Last updated:** [March 25, 2018, 8:35pm UTC](https://discourse.julialang.org/t/trying-to-switch-from-sympy/9927 "2018-03-25T20:35:52Z")

</div>

Hi, I’m pretty new to Julia, coming from Python. In the transition process I’m looking at the different symbolic math options in Julia, both SymEngine.jl, and SymPy.jl I was wondering if there’s a way to lambdify a sym…

---

## [How to get Julia home in Julia 0.7?](https://discourse.julialang.org/t/how-to-get-julia-home-in-julia-0-7/9953)

<div class="topic-metadata">

**Author:** [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Replies:** 4\
**Last updated:** [March 25, 2018, 4:04pm UTC](https://discourse.julialang.org/t/how-to-get-julia-home-in-julia-0-7/9953 "2018-03-25T16:04:25Z")

</div>

How can I get Julia home directory in 0.7? In 0.6 we could ccall jl\_get\_julia\_home, but it seems to be missing from the latest master. Context: I’m trying to help in migrating Sugar.jl which uses jl\_get\_julia\_home to di…

---

## [@threads and @generated clash?](https://discourse.julialang.org/t/threads-and-generated-clash/9950)

<div class="topic-metadata">

**Author:** [@cortner](https://discourse.julialang.org/u/cortner)\
**Replies:** 13\
**Last updated:** [March 25, 2018, 3:04pm UTC](https://discourse.julialang.org/t/threads-and-generated-clash/9950 "2018-03-25T15:04:09Z")

</div>

Is it possible that @threads cannot be used in a @generated function? Is there a workaround? @generated function test(::Val{N}) where N quote Base.Threads.@threads for i = 1:$N i^2 end end end…

---

## [Groupby for regular array](https://discourse.julialang.org/t/groupby-for-regular-array/9877)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 10\
**Last updated:** [March 25, 2018, 10:35am UTC](https://discourse.julialang.org/t/groupby-for-regular-array/9877 "2018-03-25T10:35:28Z")

</div>

Hi there. Does anyone know a function or a package that can do the same DataFrame groupby function on a regular array? e.g. julia\> A = \[1,2,3,4,1,2,4,4\] 8-element Array{Int64,1}: 1 2 3 4 1 2 4 4 Then, sortperm …

---

## [Efficiency of channels?](https://discourse.julialang.org/t/efficiency-of-channels/9952)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 3\
**Last updated:** [March 25, 2018, 2:38am UTC](https://discourse.julialang.org/t/efficiency-of-channels/9952 "2018-03-25T02:38:27Z")

</div>

I’ve been attempting to use channels to implement a discrete time simulation and in my simple test code i have found that they seem to incur a lot of overhead. just moving a single value into the producer channel and ou…

---

## [Problem returning vector of custom type in Julia embeeded](https://discourse.julialang.org/t/problem-returning-vector-of-custom-type-in-julia-embeeded/9891)

<div class="topic-metadata">

**Author:** [@nextr](https://discourse.julialang.org/u/nextr)\
**Replies:** 5\
**Last updated:** [March 24, 2018, 9:52pm UTC](https://discourse.julialang.org/t/problem-returning-vector-of-custom-type-in-julia-embeeded/9891 "2018-03-24T21:52:12Z")

</div>

I need to call a Julia function from C++ which returns a Vector of a custom type. This doesn’t work, the vector has the correct number of elements but they are empty. I have a Julia type and a Julia function as followi…

---

## [Run and visualise methods in ManifoldLearning.jl](https://discourse.julialang.org/t/run-and-visualise-methods-in-manifoldlearning-jl/9947)

<div class="topic-metadata">

**Author:** [@burfel](https://discourse.julialang.org/u/burfel)\
**Replies:** 0\
**Last updated:** [March 24, 2018, 5:35pm UTC](https://discourse.julialang.org/t/run-and-visualise-methods-in-manifoldlearning-jl/9947 "2018-03-24T17:35:35Z")

</div>

Hello, I am using the package ManifoldLearning.jl Can anyone help me get these methods (except LEM and LTSA) running, it seems they’re broken? Also, how can I visualise the LEM and LTSA output object? When I try Y\_L…

---

## [Best way to interact with REST API using JSON API standard?](https://discourse.julialang.org/t/best-way-to-interact-with-rest-api-using-json-api-standard/9933)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 1\
**Last updated:** [March 24, 2018, 6:41am UTC](https://discourse.julialang.org/t/best-way-to-interact-with-rest-api-using-json-api-standard/9933 "2018-03-24T06:41:32Z")

</div>

Let’s say you have a separate server you want to tie into through a REST API. What is the best way to construct data objects that fit to the JSON API standard? This for example would allow communication between a Rails…

---

## [Way to make salted api call within a package?](https://discourse.julialang.org/t/way-to-make-salted-api-call-within-a-package/9928)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 4\
**Last updated:** [March 24, 2018, 1:58am UTC](https://discourse.julialang.org/t/way-to-make-salted-api-call-within-a-package/9928 "2018-03-24T01:58:31Z")

</div>

Two use cases: Let’s say you wanted to record troubleshooting information from inside your package. However, you don’t want endusers (at the applications\* level) to have access to your api for sending the diagnosti…

---

## [Fastmath and forwarddiff](https://discourse.julialang.org/t/fastmath-and-forwarddiff/9934)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 1\
**Last updated:** [March 24, 2018, 1:43am UTC](https://discourse.julialang.org/t/fastmath-and-forwarddiff/9934 "2018-03-24T01:43:00Z")

</div>

Is there a straightforward way to combine @fastmath with ForwardDiff? The idea is that I might define a function f(x) using @fastmath and I then want to evaluate f'(x) using ForwardDiff. My naive attempt generates an e…

---

## [trouble precompiling packages](https://discourse.julialang.org/t/trouble-precompiling-packages/9875)

<div class="topic-metadata">

**Author:** [@bhawkins](https://discourse.julialang.org/u/bhawkins)\
**Replies:** 4\
**Last updated:** [March 23, 2018, 8:02pm UTC](https://discourse.julialang.org/t/trouble-precompiling-packages/9875 "2018-03-23T20:02:23Z")

</div>

I’ve been happily using julia 0.6.0 on a linux box for a while. Today I tried to add the HDF5 package in the usual way, Pkg.add("HDF5"). This worked fine, but using HDF5 gave me an error. I thought maybe some dependencie…

---

## [How can an infix operator with subscript such as ⋆ₛ work?](https://discourse.julialang.org/t/how-can-an-infix-operator-with-subscript-such-as-work/9929)

<div class="topic-metadata">

**Author:** [@suiato](https://discourse.julialang.org/u/suiato)\
**Replies:** 2\
**Last updated:** [March 23, 2018, 7:26pm UTC](https://discourse.julialang.org/t/how-can-an-infix-operator-with-subscript-such-as-work/9929 "2018-03-23T19:26:08Z")

</div>

Using ⋆ as an infix operator works in Julia. For example, function ⋆(a, b) a + b end works. But, function ⋆ₛ(a, b) a + b end gives an error message ERROR: syntax: expected “end” in definition of function “⋆”. I…

---

## [Determining the tree in REQUIRE](https://discourse.julialang.org/t/determining-the-tree-in-require/9930)

<div class="topic-metadata">

**Author:** [@huckl3b3rry87](https://discourse.julialang.org/u/huckl3b3rry87)\
**Replies:** 0\
**Last updated:** [March 23, 2018, 6:54pm UTC](https://discourse.julialang.org/t/determining-the-tree-in-require/9930 "2018-03-23T18:54:32Z")

</div>

I am getting some annoying warnings when I try to use my packages: julia\> using NLOptControl, PrettyPlots INFO: Recompiling stale cache file /home/febbo/.julia/lib/v0.6/StatsBase.ji for module StatsBase. INFO: Recompili…

---

## [Plots.jl/Jupyter figure?](https://discourse.julialang.org/t/plots-jl-jupyter-figure/9925)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 5\
**Last updated:** [March 23, 2018, 5:09pm UTC](https://discourse.julialang.org/t/plots-jl-jupyter-figure/9925 "2018-03-23T17:09:31Z")

</div>

I’ve slowly been moving over from PyPlot to Plots.jl and one thing that seems missing is an analog of figure(). This shows up when I have a cell in a Jupyter notebook, and I want to create several plots, one after ano…

---

## [Mixing vectorization and parallelization](https://discourse.julialang.org/t/mixing-vectorization-and-parallelization/9800)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 5\
**Last updated:** [March 23, 2018, 4:18pm UTC](https://discourse.julialang.org/t/mixing-vectorization-and-parallelization/9800 "2018-03-23T16:18:22Z")

</div>

I have a Monte Carlo computation that involves computing an ensemble average of random vectors. If I were to compute this using vectorization, it would look like: Ybar = zeros(d); for j = 1:nsamples @. Ybar += f(ra…

---

## [Assign Uniform scaling to Matrix with setindex](https://discourse.julialang.org/t/assign-uniform-scaling-to-matrix-with-setindex/9919)

<div class="topic-metadata">

**Author:** [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Replies:** 3\
**Last updated:** [March 23, 2018, 12:22pm UTC](https://discourse.julialang.org/t/assign-uniform-scaling-to-matrix-with-setindex/9919 "2018-03-23T12:22:43Z")

</div>

Say I have a function function f(a,x) a\[:,:\] = x end a = zeros(2,2) x = eye(2) f(a,x) # Works fine f(a,I) # Does not work ERROR: MethodError: Cannot \`convert\` an object of type LinearAlgebra.UniformScaling{Bool} to …

---

## [Unit test for f()=print("something")](https://discourse.julialang.org/t/unit-test-for-f-print-something/9876)

<div class="topic-metadata">

**Author:** [@jandehaan](https://discourse.julialang.org/u/jandehaan)\
**Replies:** 8\
**Last updated:** [March 23, 2018, 4:05am UTC](https://discourse.julialang.org/t/unit-test-for-f-print-something/9876 "2018-03-23T04:05:19Z")

</div>

I would like to write unit tests like the following f() = print("something") @test print\_to\_string(f) == "something" I’m not able to successfully define the function print\_to\_string. I’m getting lost while searching t…

---

## [Groupby function?](https://discourse.julialang.org/t/groupby-function/9896)

<div class="topic-metadata">

**Author:** [@Jean\_Michel](https://discourse.julialang.org/u/Jean_Michel)\
**Replies:** 7\
**Last updated:** [March 23, 2018, 3:24am UTC](https://discourse.julialang.org/t/groupby-function/9896 "2018-03-23T03:24:25Z")

</div>

While porting GAP code, I translated the function CollectBy (that I find very useful) as: """ group items of list l according to the corresponding values in list v julia\> groupby(\[31,28,31,30,31,30,31,31,30,31,3…

---

## [Macro challenge: Factory for creating named tuples](https://discourse.julialang.org/t/macro-challenge-factory-for-creating-named-tuples/9748)

<div class="topic-metadata">

**Author:** [@jlperla](https://discourse.julialang.org/u/jlperla)\
**Replies:** 32\
**Last updated:** [March 22, 2018, 9:20pm UTC](https://discourse.julialang.org/t/macro-challenge-factory-for-creating-named-tuples/9748 "2018-03-22T21:20:16Z")

</div>

Named tuples are a great way to work with sets of parameters where the type can be inferred. Compared to using a named structure with Parameters.jl, the big thing missing seems to be creating them with default values. S…

---

## [Inconsistent hashing of types containing \`Set\` or \`Array\` fields](https://discourse.julialang.org/t/inconsistent-hashing-of-types-containing-set-or-array-fields/9900)

<div class="topic-metadata">

**Author:** [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Replies:** 5\
**Last updated:** [March 22, 2018, 4:51pm UTC](https://discourse.julialang.org/t/inconsistent-hashing-of-types-containing-set-or-array-fields/9900 "2018-03-22T16:51:26Z")

</div>

Consider struct TestType S::Set{Int} end t1 = TestType(Set(\[1,2\])) t2 = TestType(Set(\[1,2\])) Then I do julia\> hash(t1) 0x9e50ff0d6c1bbf02 julia\> hash(t2) 0x8a1b971008dc34e8 Well, that’s kind of annoying, but at…

---

## [Interpolate inside a Quote inside a Macro inside a Quote?](https://discourse.julialang.org/t/interpolate-inside-a-quote-inside-a-macro-inside-a-quote/9888)

<div class="topic-metadata">

**Author:** [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Replies:** 3\
**Last updated:** [March 22, 2018, 3:03pm UTC](https://discourse.julialang.org/t/interpolate-inside-a-quote-inside-a-macro-inside-a-quote/9888 "2018-03-22T15:03:00Z")

</div>

Is it possible to do this? I need this for my package Reduce.jl Let’s say I have a bunch of functions, call them fun and I need a macro for each macro fun(expr) :(fun($expr)) end But I need to automate this using …

---

## [IJulia displayed image size](https://discourse.julialang.org/t/ijulia-displayed-image-size/9880)

<div class="topic-metadata">

**Author:** [@denizyuret](https://discourse.julialang.org/u/denizyuret)\
**Replies:** 2\
**Last updated:** [March 22, 2018, 1:14pm UTC](https://discourse.julialang.org/t/ijulia-displayed-image-size/9880 "2018-03-22T13:14:41Z")

</div>

How can I control the size of the images displayed in IJulia? It seems to pick a size regardless of the pixel size in a way I don’t understand.

---

## [Really? Not irrational?](https://discourse.julialang.org/t/really-not-irrational/9485)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 19\
**Last updated:** [March 22, 2018, 12:55pm UTC](https://discourse.julialang.org/t/really-not-irrational/9485 "2018-03-22T12:55:24Z")

</div>

I told my 13-year old girl that Julia has both rational and irrational types. How we started this conversation is a different story :slight\_smile: As I showed off how it works in the REPL, she pointed out that it’s wron…

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

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