# General Usage

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

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

**Page:** 1005

---

## [How to remove an item from a linked list in Julia?](https://discourse.julialang.org/t/how-to-remove-an-item-from-a-linked-list-in-julia/8145)

<div class="topic-metadata">

**Author:** [@QUANG\_VU\_NGUY\_N\_PH\_M](https://discourse.julialang.org/u/QUANG_VU_NGUY_N_PH_M)\
**Replies:** 8\
**Last updated:** [January 5, 2018, 6:50pm UTC](https://discourse.julialang.org/t/how-to-remove-an-item-from-a-linked-list-in-julia/8145 "2018-01-05T18:50:58Z")

</div>

Please help me how can we remove an item from a linked list. In the code below, I can make a list by: julia\> L = list(1,3,5,7,9) list(1,3,5,7,9) Then, how to remove the 3rd element from L? type Node value::Number…

---

## [Is there a way to test if something \`isexported()\`?](https://discourse.julialang.org/t/is-there-a-way-to-test-if-something-isexported/8139)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 8\
**Last updated:** [January 5, 2018, 5:02pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-test-if-something-isexported/8139 "2018-01-05T17:02:49Z")

</div>

Sometimes isdefined is a little too loose. Is there a way to see if a variable is explicitly exported by a module? Example: # src/FizzBuzz.jl module FizzBuzz export foo foo() = println("hello") bar() = prin…

---

## [Immutable deprecation fix in BayesianDataFusion](https://discourse.julialang.org/t/immutable-deprecation-fix-in-bayesiandatafusion/8182)

<div class="topic-metadata">

**Author:** [@spinkney](https://discourse.julialang.org/u/spinkney)\
**Replies:** 2\
**Last updated:** [January 5, 2018, 3:59pm UTC](https://discourse.julialang.org/t/immutable-deprecation-fix-in-bayesiandatafusion/8182 "2018-01-05T15:59:06Z")

</div>

I’m a Julia noob and I’m trying to get BayesianDataFusion.jl to work with 0.6. I found that the issue I have is related to the deprecation of immutable to using struct. I created an attempt at a fix but I have zero confi…

---

## [How to define an efficient \`bswap\_int\` for user defined primitive types?](https://discourse.julialang.org/t/how-to-define-an-efficient-bswap-int-for-user-defined-primitive-types/8051)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 8\
**Last updated:** [January 5, 2018, 7:05am UTC](https://discourse.julialang.org/t/how-to-define-an-efficient-bswap-int-for-user-defined-primitive-types/8051 "2018-01-05T07:05:48Z")

</div>

I am trying to define my own primitive type of bit-length 8\*n for some n, e.g. below I have n=3. The functions lshr\_int and shl\_int works directly on the newly-defined type but not bswap\_int. I tried to check its defini…

---

## [Weird type instability](https://discourse.julialang.org/t/weird-type-instability/4120)

<div class="topic-metadata">

**Author:** [@jebej](https://discourse.julialang.org/u/jebej)\
**Replies:** 8\
**Last updated:** [January 5, 2018, 1:43am UTC](https://discourse.julialang.org/t/weird-type-instability/4120 "2018-01-05T01:43:41Z")

</div>

I am having trouble understanding why fun1 has a type instability, and not fun2, is this a bug? function fun1(N::Integer, a::Number, test::Bool=false) if test b = exp(-abs2(a)/2) x = \[(3b^n+2)/(n+1) …

---

## [Error Precompiling module Atom](https://discourse.julialang.org/t/error-precompiling-module-atom/8156)

<div class="topic-metadata">

**Author:** [@zygmuntszpak](https://discourse.julialang.org/u/zygmuntszpak)\
**Replies:** 1\
**Last updated:** [January 5, 2018, 1:35am UTC](https://discourse.julialang.org/t/error-precompiling-module-atom/8156 "2018-01-05T01:35:32Z")

</div>

Hi all, I’m running Julia Version 0.6.2 (2017-12-13 18:08 UTC) x86\_64-w64-mingw32 and have the following packages installed: 3 required packages: Atom 0.6.6 IJulia 1.…

---

## [LibCURL and FTPClient ReadOnlyMemoryError/SegFault](https://discourse.julialang.org/t/libcurl-and-ftpclient-readonlymemoryerror-segfault/8168)

<div class="topic-metadata">

**Author:** [@RankWinner](https://discourse.julialang.org/u/RankWinner)\
**Replies:** 0\
**Last updated:** [January 5, 2018, 1:35am UTC](https://discourse.julialang.org/t/libcurl-and-ftpclient-readonlymemoryerror-segfault/8168 "2018-01-05T01:35:29Z")

</div>

Today one of my modules just stopped working, for no real reason as far as I can tell since I hadn’t updated anything in a while and nothing else has changed. I’m completely at a loss for how to fix this. I’m using FTPC…

---

## [Lammps interface to julia vs. python](https://discourse.julialang.org/t/lammps-interface-to-julia-vs-python/8164)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 4\
**Last updated:** [January 5, 2018, 1:30am UTC](https://discourse.julialang.org/t/lammps-interface-to-julia-vs-python/8164 "2018-01-05T01:30:21Z")

</div>

So LAMMPS (http://lammps.sandia.gov/) has a python interface which I have been trying to use within Julia, with some success. However, I had two points I wanted to query the community about. First, when I wish to acces…

---

## [How to convert a pointer to String back to a String?](https://discourse.julialang.org/t/how-to-convert-a-pointer-to-string-back-to-a-string/8121)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 10\
**Last updated:** [January 4, 2018, 9:00pm UTC](https://discourse.julialang.org/t/how-to-convert-a-pointer-to-string-back-to-a-string/8121 "2018-01-04T21:00:38Z")

</div>

I can create a pointer to a String using pointer and if I have a pointer to a string what’s the way to “convert” it back? Basically create a String where the first char is pointed at by the pointer s = "abc" ptr = point…

---

## [ERROR: OrdinaryDiffEq can't be installed because it has no versions that support 0.6.2 of julia](https://discourse.julialang.org/t/error-ordinarydiffeq-cant-be-installed-because-it-has-no-versions-that-support-0-6-2-of-julia/8159)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 9\
**Last updated:** [January 4, 2018, 7:56pm UTC](https://discourse.julialang.org/t/error-ordinarydiffeq-cant-be-installed-because-it-has-no-versions-that-support-0-6-2-of-julia/8159 "2018-01-04T19:56:53Z")

</div>

This is somewhat cryptic. After a Pkg.update(), julia\> Pkg.checkout("NLSolversBase") INFO: Checking out NLSolversBase master... INFO: Pulling NLSolversBase latest master... ERROR: OrdinaryDiffEq can't be installed becau…

---

## [Nesting ForwardDiff inside ReverseDiff?](https://discourse.julialang.org/t/nesting-forwarddiff-inside-reversediff/3684)

<div class="topic-metadata">

**Author:** [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Replies:** 5\
**Last updated:** [January 4, 2018, 7:01pm UTC](https://discourse.julialang.org/t/nesting-forwarddiff-inside-reversediff/3684 "2018-01-04T19:01:41Z")

</div>

Let’s say I have a function f over an input x and a set of parameters w. For example: f = (x, w) -\> sum(x .\* w) I would like to compute the cross-terms of the hessian of f. That is, I would like to compute the gradient…

---

## [Full/square SVD and dimension mismatch](https://discourse.julialang.org/t/full-square-svd-and-dimension-mismatch/8157)

<div class="topic-metadata">

**Author:** [@Axel\_Gagge](https://discourse.julialang.org/u/Axel_Gagge)\
**Replies:** 2\
**Last updated:** [January 4, 2018, 2:59pm UTC](https://discourse.julialang.org/t/full-square-svd-and-dimension-mismatch/8157 "2018-01-04T14:59:47Z")

</div>

I noticed that A = rand(2, 1) U, S, V = svd(A; thin=false) U\*diagm(S)\*V' ≈ A produces the error (Julia 0.6.2): ERROR: DimensionMismatch("A has dimensions (2,2) but B has dimensions (1,1)") Stacktrace: \[1\] gemm\_wrappe…

---

## [Warnings from Mocha / Memento getlogger addhandler](https://discourse.julialang.org/t/warnings-from-mocha-memento-getlogger-addhandler/8127)

<div class="topic-metadata">

**Author:** [@Colin\_Beckingham](https://discourse.julialang.org/u/Colin_Beckingham)\
**Replies:** 2\
**Last updated:** [January 4, 2018, 1:40pm UTC](https://discourse.julialang.org/t/warnings-from-mocha-memento-getlogger-addhandler/8127 "2018-01-04T13:40:19Z")

</div>

Using compiled Julia 0.6: I’m puzzled by the warnings I am getting from Mocha via Memento logging which seem to indicate that functions get\_logger and add\_handler are deprecated in favour of getlogger and addhandler. How…

---

## [Can we make a list of common keyboard symbols for Mac?](https://discourse.julialang.org/t/can-we-make-a-list-of-common-keyboard-symbols-for-mac/8142)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 3\
**Last updated:** [January 4, 2018, 1:28pm UTC](https://discourse.julialang.org/t/can-we-make-a-list-of-common-keyboard-symbols-for-mac/8142 "2018-01-04T13:28:56Z")

</div>

A lot of people on this forum frequently use ≠, ≈, etc. This is awesome because Julia enables it, but I’m guessing many coders avoid them like the plague. As a new year’s resolution, maybe we can get everyone (at least…

---

## [help understanding performance with assignment to allocated matrix](https://discourse.julialang.org/t/help-understanding-performance-with-assignment-to-allocated-matrix/8149)

<div class="topic-metadata">

**Author:** [@rmar](https://discourse.julialang.org/u/rmar)\
**Replies:** 6\
**Last updated:** [January 4, 2018, 8:03am UTC](https://discourse.julialang.org/t/help-understanding-performance-with-assignment-to-allocated-matrix/8149 "2018-01-04T08:03:26Z")

</div>

A pattern I often find useful is to assign to a slice of a matrix in a loop, forgoing the innermost loop, e.g.: for idat in 1:ndata array\[:, idat\] = \[xval, yval, zval\] end The vector of values assigned to the slice…

---

## [Is there a shorthand for "getfield if isdefined"?](https://discourse.julialang.org/t/is-there-a-shorthand-for-getfield-if-isdefined/7902)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 3\
**Last updated:** [January 3, 2018, 1:01am UTC](https://discourse.julialang.org/t/is-there-a-shorthand-for-getfield-if-isdefined/7902 "2018-01-03T01:01:42Z")

</div>

For example, work\_module = Main work\_method = :push! cur\_var = isdefined(work\_module, work\_method) ? getfield(work\_module, work\_method) : nothing // i.e. \> println( softget(Main, :push!) ) push! \> println( …

---

## [Some confusion around how IO works for an IOStream opened in append mode](https://discourse.julialang.org/t/some-confusion-around-how-io-works-for-an-iostream-opened-in-append-mode/8148)

<div class="topic-metadata">

**Author:** [@colintbowers](https://discourse.julialang.org/u/colintbowers)\
**Replies:** 3\
**Last updated:** [January 4, 2018, 5:22am UTC](https://discourse.julialang.org/t/some-confusion-around-how-io-works-for-an-iostream-opened-in-append-mode/8148 "2018-01-04T05:22:49Z")

</div>

I don’t know very much about IO, but I’m struggling a little bit with something and was just wondering if the behaviour is as expected. I create a binary file with one Float64 in it as follows: open(fid-\>write(fid, 1.0)…

---

## [Is there any elegant julian way how to do what python could do with decorator?](https://discourse.julialang.org/t/is-there-any-elegant-julian-way-how-to-do-what-python-could-do-with-decorator/8118)

<div class="topic-metadata">

**Author:** [@Liso](https://discourse.julialang.org/u/Liso)\
**Replies:** 21\
**Last updated:** [January 3, 2018, 9:33pm UTC](https://discourse.julialang.org/t/is-there-any-elegant-julian-way-how-to-do-what-python-could-do-with-decorator/8118 "2018-01-03T21:33:12Z")

</div>

My motivation was to make something like python’s decorator… But Julia seems to be designed otherwise. Is this intended? For what purpose? julia\> wtf() = show("what the function!"); julia\> \_wtf = wtf; # I wanted to r…

---

## [Unsafe\_wrap with array of arrays](https://discourse.julialang.org/t/unsafe-wrap-with-array-of-arrays/8120)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 8\
**Last updated:** [January 3, 2018, 9:24pm UTC](https://discourse.julialang.org/t/unsafe-wrap-with-array-of-arrays/8120 "2018-01-03T21:24:04Z")

</div>

I have data (originally pulled in from python via pycall) that is naturally stored in a 2D array (N, 3) (i…e, it is an array of points in 3D). Right now, I can wrap this in Julia with the command: X = unsafe\_wrap(Array…

---

## [Promote/widen numerical types under +, \*, sqrt, log](https://discourse.julialang.org/t/promote-widen-numerical-types-under-sqrt-log/8137)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 6\
**Last updated:** [January 3, 2018, 7:44pm UTC](https://discourse.julialang.org/t/promote-widen-numerical-types-under-sqrt-log/8137 "2018-01-03T19:44:09Z")

</div>

I have a tuple of numerical types. I am looking for the type that would result after combining these types with +, \*, sqrt, log. Is there a function to do this? Context: I am writing a function (too complex for an MWE h…

---

## [Variable scoping in macros: Deprecated syntax \`implicit assignment to global variable\`](https://discourse.julialang.org/t/variable-scoping-in-macros-deprecated-syntax-implicit-assignment-to-global-variable/8131)

<div class="topic-metadata">

**Author:** [@John\_Gibson](https://discourse.julialang.org/u/John_Gibson)\
**Replies:** 2\
**Last updated:** [January 3, 2018, 5:33pm UTC](https://discourse.julialang.org/t/variable-scoping-in-macros-deprecated-syntax-implicit-assignment-to-global-variable/8131 "2018-01-03T17:33:43Z")

</div>

I’m running into a deprecation when running the test/perf/micro benchmarks in 0.7-DEV. The issue is implicit declaration and assignment of global variables in the @timeit macro in test/perf/perfutils.jl. Here it is boile…

---

## [Julia crashes when started on the nodes of a HPC cluster](https://discourse.julialang.org/t/julia-crashes-when-started-on-the-nodes-of-a-hpc-cluster/8065)

<div class="topic-metadata">

**Author:** [@Maurizio\_Tomasi](https://discourse.julialang.org/u/Maurizio_Tomasi)\
**Replies:** 8\
**Last updated:** [January 3, 2018, 5:28pm UTC](https://discourse.julialang.org/t/julia-crashes-when-started-on-the-nodes-of-a-hpc-cluster/8065 "2018-01-03T17:28:34Z")

</div>

Hi to everybody, I’m trying to run Julia on a HPC cluster we are using in our department for astrophysical simulations. The 64-bit system is running CentOS 6.2, and it has a front-end and 8 computing nodes, each with 12…

---

## [How do DataFrames.jl compare to R's? And Interoperability between R and Julia](https://discourse.julialang.org/t/how-do-dataframes-jl-compare-to-rs-and-interoperability-between-r-and-julia/7387)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 23\
**Last updated:** [January 3, 2018, 3:10pm UTC](https://discourse.julialang.org/t/how-do-dataframes-jl-compare-to-rs-and-interoperability-between-r-and-julia/7387 "2018-01-03T15:10:47Z")

</div>

Congratulations on the new package. Feel free to state how it (and Julia in general) compares to R, or at least these specific questions. a) How does the solution compare to R’s? I mean, should I \[keep\] refrain from re…

---

## [Weird Pkg.update() behavior (again)](https://discourse.julialang.org/t/weird-pkg-update-behavior-again/7786)

<div class="topic-metadata">

**Author:** [@crbinz](https://discourse.julialang.org/u/crbinz)\
**Replies:** 1\
**Last updated:** [January 3, 2018, 2:11pm UTC](https://discourse.julialang.org/t/weird-pkg-update-behavior-again/7786 "2018-01-03T14:11:28Z")

</div>

Using Julia 0.6.1 on Windows, Pkg.update() fails: julia\> Pkg.update() INFO: Updating METADATA... INFO: Updating LoewnerJohnEllipsoids master... INFO: Updating EarthOrientation master... INFO: Updating PolygonClipping ma…

---

## [UndefVarError(:JULIA\_HOME) when building user image involving Compat](https://discourse.julialang.org/t/undefvarerror-julia-home-when-building-user-image-involving-compat/8123)

<div class="topic-metadata">

**Author:** [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Replies:** 2\
**Last updated:** [January 3, 2018, 9:33am UTC](https://discourse.julialang.org/t/undefvarerror-julia-home-when-building-user-image-involving-compat/8123 "2018-01-03T09:33:48Z")

</div>

I am trying to build a userimage by running include(joinpath(JULIA\_HOME, Base.DATAROOTDIR, "julia", "build\_sysimg.jl")) build\_sysimg(default\_sysimg\_path(), "native", "userimage.jl", force=true) where the file userimage…

---

## [JLD: lazy loading of \`Dict\`?](https://discourse.julialang.org/t/jld-lazy-loading-of-dict/8115)

<div class="topic-metadata">

**Author:** [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Replies:** 1\
**Last updated:** [January 3, 2018, 8:07am UTC](https://discourse.julialang.org/t/jld-lazy-loading-of-dict/8115 "2018-01-03T08:07:07Z")

</div>

I’m wondering if it’s possible to lazily load a Dict from a JLD file, or the equivalent thereof, by which I mean, if I have a JLD file of size N I want to load values from my Dict only touching n\\ll N bytes of the file. …

---

## [Juno unreasonably slow at random](https://discourse.julialang.org/t/juno-unreasonably-slow-at-random/7878)

<div class="topic-metadata">

**Author:** [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Replies:** 3\
**Last updated:** [January 3, 2018, 7:31am UTC](https://discourse.julialang.org/t/juno-unreasonably-slow-at-random/7878 "2018-01-03T07:31:09Z")

</div>

Since the last update of julia-client, I am experiencing random hiccups of the julia client, often in conjunction with plotting. There is no significant processor load, and when I press ctrl-c I get the following trace I…

---

## [Type inference for parallel computing](https://discourse.julialang.org/t/type-inference-for-parallel-computing/8122)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 1\
**Last updated:** [January 3, 2018, 7:10am UTC](https://discourse.julialang.org/t/type-inference-for-parallel-computing/8122 "2018-01-03T07:10:17Z")

</div>

I have a small program, whose prototype looks like: @everywhere function \_calculate(kpts::Matrix{Float64}) return prod(kpts) end function calculate(nkmesh::Vector{Int64}) nkpts = prod(nkmesh) kpts = zeros(3…

---

## [Is there a way to enumerate through all non-NaN values of Float16?](https://discourse.julialang.org/t/is-there-a-way-to-enumerate-through-all-non-nan-values-of-float16/8117)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 5\
**Last updated:** [January 3, 2018, 2:40am UTC](https://discourse.julialang.org/t/is-there-a-way-to-enumerate-through-all-non-nan-values-of-float16/8117 "2018-01-03T02:40:04Z")

</div>

I can make the following list of Float16 values but it generates NaNs as well. I can also get rid of NaN’s. But is there a ready built way to enumerate through all non-NaN values of Float16? FLOAT16\_UNIQS = reinterpret.…

---

## [Is this pure?](https://discourse.julialang.org/t/is-this-pure/8050)

<div class="topic-metadata">

**Author:** [@bramtayl](https://discourse.julialang.org/u/bramtayl)\
**Replies:** 7\
**Last updated:** [January 3, 2018, 1:29am UTC](https://discourse.julialang.org/t/is-this-pure/8050 "2018-01-03T01:29:36Z")

</div>

Base.@pure which\_key(tuple::NTuple{N, Symbol}, key::Symbol) where N = map(x -\> x == key, tuple)

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

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