# General Usage

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

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

**Page:** 1006

---

## [Why this program have type issues?](https://discourse.julialang.org/t/why-this-program-have-type-issues/8112)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 2\
**Last updated:** [January 2, 2018, 4:07pm UTC](https://discourse.julialang.org/t/why-this-program-have-type-issues/8112 "2018-01-02T16:07:34Z")

</div>

I have a small program here: using StaticArrays struct NoTBModel norbits::Int64 lat::SMatrix{3,3,Float64} hoppings::Dict{SVector{3,Int64},SparseMatrixCSC{Complex{Float64},Int64}} end function calculatemodel(…

---

## [What's so mutable about \`Symbol\`s?](https://discourse.julialang.org/t/whats-so-mutable-about-symbol-s/8094)

<div class="topic-metadata">

**Author:** [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Replies:** 10\
**Last updated:** [January 1, 2018, 5:42pm UTC](https://discourse.julialang.org/t/whats-so-mutable-about-symbol-s/8094 "2018-01-01T17:42:08Z")

</div>

May someone explain the rationale behind making Symbols mutable? They seem to have no fields to mutate!

---

## [Redundant sort / sortperm options: why?](https://discourse.julialang.org/t/redundant-sort-sortperm-options-why/5631)

<div class="topic-metadata">

**Author:** [@anon94023334](https://discourse.julialang.org/u/anon94023334)\
**Replies:** 2\
**Last updated:** [January 1, 2018, 1:26pm UTC](https://discourse.julialang.org/t/redundant-sort-sortperm-options-why/5631 "2018-01-01T13:26:01Z")

</div>

sort and sortperm take a couple of keyword arguments that appear to be redundant (at least, one of them is a subset of the other): rev and order. That is: julia\> sortperm(a, rev=true) == sortperm(a, order=Base.Order.Rev…

---

## [Sort huge array get smallest 1000](https://discourse.julialang.org/t/sort-huge-array-get-smallest-1000/8081)

<div class="topic-metadata">

**Author:** [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Replies:** 5\
**Last updated:** [December 31, 2017, 5:00pm UTC](https://discourse.julialang.org/t/sort-huge-array-get-smallest-1000/8081 "2017-12-31T17:00:11Z")

</div>

Is there a function which sorts an array up to a given size? I know that quicksort divides the array into “halves” every time which should make it easy to get the smallest 1000 in an array of a million values. Does some…

---

## [Looking for feedback on package type design - tree log volumes](https://discourse.julialang.org/t/looking-for-feedback-on-package-type-design-tree-log-volumes/8078)

<div class="topic-metadata">

**Author:** [@Crghilardi](https://discourse.julialang.org/u/Crghilardi)\
**Replies:** 1\
**Last updated:** [December 31, 2017, 7:36am UTC](https://discourse.julialang.org/t/looking-for-feedback-on-package-type-design-tree-log-volumes/8078 "2017-12-31T07:36:16Z")

</div>

Hello, I have tried my best to drink the kool-aid of generic API type design, but I have been struggling while working on trying to figure out what a Julian API set up would look like for calculating the volume of logs.…

---

## [How to handle code availability in a parallel-computing-enabled package](https://discourse.julialang.org/t/how-to-handle-code-availability-in-a-parallel-computing-enabled-package/8080)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 3\
**Last updated:** [December 31, 2017, 7:01am UTC](https://discourse.julialang.org/t/how-to-handle-code-availability-in-a-parallel-computing-enabled-package/8080 "2017-12-31T07:01:43Z")

</div>

I am becoming increasingly confused about code availability in parallel computing. Basically, I want to write a package that will distribute tasks automatically on all processes and I don’t know how to understand code av…

---

## [Strange Lispy warning on master](https://discourse.julialang.org/t/strange-lispy-warning-on-master/7999)

<div class="topic-metadata">

**Author:** [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Replies:** 21\
**Last updated:** [December 30, 2017, 7:41pm UTC](https://discourse.julialang.org/t/strange-lispy-warning-on-master/7999 "2017-12-30T19:41:46Z")

</div>

I’m not sure what I’m supposed to do with this: WARNING: deprecated syntax “parametric method syntax (::Core.Type{Str{T}}){(var-bounds T #f #f)}(S, v::Vector{UInt8}) around /Users/scott/.julia/v0.7/Strs/src/types.jl:57…

---

## [Parse plist (apple XML propertylist)](https://discourse.julialang.org/t/parse-plist-apple-xml-propertylist/8066)

<div class="topic-metadata">

**Author:** [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Replies:** 3\
**Last updated:** [December 30, 2017, 2:46pm UTC](https://discourse.julialang.org/t/parse-plist-apple-xml-propertylist/8066 "2017-12-30T14:46:54Z")

</div>

Might be done by PyCall and plistlib, but i’d prefer a julia-only. Any idea? Or at least a recommendation for XML?

---

## [Gluing symbolic manipulations from Calculus.jl to write a julia code for a gradient and a Jacobian](https://discourse.julialang.org/t/gluing-symbolic-manipulations-from-calculus-jl-to-write-a-julia-code-for-a-gradient-and-a-jacobian/7698)

<div class="topic-metadata">

**Author:** [@Janis\_Erdmanis](https://discourse.julialang.org/u/Janis_Erdmanis)\
**Replies:** 15\
**Last updated:** [December 30, 2017, 10:15am UTC](https://discourse.julialang.org/t/gluing-symbolic-manipulations-from-calculus-jl-to-write-a-julia-code-for-a-gradient-and-a-jacobian/7698 "2017-12-30T10:15:04Z")

</div>

Lately I have had some deep procrastinating thoughts coming from putting some crazy function into a minimizer. The issue is that I would prefer not to write out an analytic Jacobian as that introduces a lot of human erro…

---

## [How to make a C function compiled by myself available to \`ccall\`?](https://discourse.julialang.org/t/how-to-make-a-c-function-compiled-by-myself-available-to-ccall/7972)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 39\
**Last updated:** [December 30, 2017, 8:50am UTC](https://discourse.julialang.org/t/how-to-make-a-c-function-compiled-by-myself-available-to-ccall/7972 "2017-12-30T08:50:23Z")

</div>

I am completely new to C and I just wanted to see if someone can help me with making a C function available to ccall. As a MWE I have // example.c file #include \<stddef.h\> void radix\_sort(char \*\*strings) { const size\_…

---

## [Is JULIA suitable for the development of proprietary derived-softwares?](https://discourse.julialang.org/t/is-julia-suitable-for-the-development-of-proprietary-derived-softwares/7912)

<div class="topic-metadata">

**Author:** [@NKC](https://discourse.julialang.org/u/NKC)\
**Replies:** 31\
**Last updated:** [December 29, 2017, 10:13pm UTC](https://discourse.julialang.org/t/is-julia-suitable-for-the-development-of-proprietary-derived-softwares/7912 "2017-12-29T22:13:49Z")

</div>

Hello all, There is an explanation on the JULIA web page as: “therefore the environment, which consists of the language, user interfaces, and libraries, is under the GPL”. I think the most strict license determines the…

---

## [Issues with AxisArrays on 0.6](https://discourse.julialang.org/t/issues-with-axisarrays-on-0-6/8064)

<div class="topic-metadata">

**Author:** [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)\
**Replies:** 8\
**Last updated:** [December 29, 2017, 9:48pm UTC](https://discourse.julialang.org/t/issues-with-axisarrays-on-0-6/8064 "2017-12-29T21:48:18Z")

</div>

Hi, I have an issue with AxisArrays since Compact (unavoidable) does now export axes julia\> using AxisArrays julia\> using Compat julia\> axes WARNING: both Compat and AxisArrays export "axes"; uses of it in module Main…

---

## [How to write bits into a user-defined primitive type?](https://discourse.julialang.org/t/how-to-write-bits-into-a-user-defined-primitive-type/8053)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 3\
**Last updated:** [December 29, 2017, 12:32pm UTC](https://discourse.julialang.org/t/how-to-write-bits-into-a-user-defined-primitive-type/8053 "2017-12-29T12:32:48Z")

</div>

I have defined my own primitive type as below which works. import Base: \>\>, \<\< primitive type UInt24 24 end \>\>(x::UInt24, y) = Base.lshr\_int(x, y) \<\<(x::UInt24, y) = Base.shl\_int(x, y) I then tried to define a maskin…

---

## [Different speed when estimating pi](https://discourse.julialang.org/t/different-speed-when-estimating-pi/8031)

<div class="topic-metadata">

**Author:** [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Replies:** 4\
**Last updated:** [December 29, 2017, 9:10am UTC](https://discourse.julialang.org/t/different-speed-when-estimating-pi/8031 "2017-12-29T09:10:15Z")

</div>

I used two sets of codes to estimate the value of pi as a simple example of Monte Carlo methods. Code 1: function compute\_pi(N::Int) n\_landed\_in\_circle = 0 for i = 1:N x = rand() y = rand() …

---

## [New parametric functions syntax has a readability problem](https://discourse.julialang.org/t/new-parametric-functions-syntax-has-a-readability-problem/8036)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 11\
**Last updated:** [December 28, 2017, 9:38pm UTC](https://discourse.julialang.org/t/new-parametric-functions-syntax-has-a-readability-problem/8036 "2017-12-28T21:38:21Z")

</div>

I’ve been upgrading some of my code base to support the new parametric functions syntax – I’m using such functions extensively, with return types declarations. My feedback is that if this has been a step forward for the …

---

## [DifferentialEquations.jl OrwenZen5 not defined](https://discourse.julialang.org/t/differentialequations-jl-orwenzen5-not-defined/8041)

<div class="topic-metadata">

**Author:** [@Ajoo](https://discourse.julialang.org/u/Ajoo)\
**Replies:** 2\
**Last updated:** [December 28, 2017, 5:44pm UTC](https://discourse.julialang.org/t/differentialequations-jl-orwenzen5-not-defined/8041 "2017-12-28T17:44:39Z")

</div>

Hi. I recently started using Julia. I’m currently trying to simulate a Mackey-Glass chaotic time-series with DifferentialEquations.jl. The package documentation advises the use of a solver OrwenZen5() for solving delay …

---

## [Strided array from array of struct](https://discourse.julialang.org/t/strided-array-from-array-of-struct/7055)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 7\
**Last updated:** [December 28, 2017, 5:21am UTC](https://discourse.julialang.org/t/strided-array-from-array-of-struct/7055 "2017-12-28T05:21:13Z")

</div>

I’ve got a Vector{Foo}, where Foo is some struct with fields a::Int, b::Float64, c::Symbol. How can I get a view corresponding to map(f-\>f.b, myvec)? In other words, how can I build a strided array that starts at &myvec+…

---

## [Optional dependencies?](https://discourse.julialang.org/t/optional-dependencies/8029)

<div class="topic-metadata">

**Author:** [@nickeubank](https://discourse.julialang.org/u/nickeubank)\
**Replies:** 3\
**Last updated:** [December 28, 2017, 4:37am UTC](https://discourse.julialang.org/t/optional-dependencies/8029 "2017-12-28T04:37:40Z")

</div>

I’d like to add a function to a library that takes a DataFrame and returns the library’s type of choice (a MetaGraph). But I’d really like to avoid making DataFrames a dependency for the library. Is there a way to creat…

---

## [CSV.read() faults on exponentially notated integers](https://discourse.julialang.org/t/csv-read-faults-on-exponentially-notated-integers/7936)

<div class="topic-metadata">

**Author:** [@r-handsfield](https://discourse.julialang.org/u/r-handsfield)\
**Replies:** 2\
**Last updated:** [December 28, 2017, 2:16am UTC](https://discourse.julialang.org/t/csv-read-faults-on-exponentially-notated-integers/7936 "2017-12-28T02:16:46Z")

</div>

Trying to read the Credit Card Fraud data set on Kaggle. The first column represents times of transactions counted in milliseconds, which Julia interprets as Int64. This is fine until it encounters 1e+05 in line 153759, …

---

## [Can methodswith() return everything?](https://discourse.julialang.org/t/can-methodswith-return-everything/8026)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 2\
**Last updated:** [December 27, 2017, 6:11pm UTC](https://discourse.julialang.org/t/can-methodswith-return-everything/8026 "2017-12-27T18:11:13Z")

</div>

I love the methodswith() function as it lets me quickly find out the functions that take a particular type directly in the REPL without having to look up the type’s documentation on the web. However, I found it to be to…

---

## [Need help interpreting an error message (DifferentialEquations.jl and IDA)](https://discourse.julialang.org/t/need-help-interpreting-an-error-message-differentialequations-jl-and-ida/7986)

<div class="topic-metadata">

**Author:** [@NiclasMattsson](https://discourse.julialang.org/u/NiclasMattsson)\
**Replies:** 10\
**Last updated:** [December 27, 2017, 3:36pm UTC](https://discourse.julialang.org/t/need-help-interpreting-an-error-message-differentialequations-jl-and-ida/7986 "2017-12-27T15:36:08Z")

</div>

I’ve written a climate model in Julia, essentially a mix of simple first order ODEs and ordinary algebraic equations (so I have a system of DAEs). I’ve successfully solved it using a straightforward manual implementation…

---

## [I can't add the package DataFrames to v"0.7.0-DEV.3182" compiled as nonGPL](https://discourse.julialang.org/t/i-cant-add-the-package-dataframes-to-v-0-7-0-dev-3182-compiled-as-nongpl/7994)

<div class="topic-metadata">

**Author:** [@NKC](https://discourse.julialang.org/u/NKC)\
**Replies:** 2\
**Last updated:** [December 27, 2017, 11:48am UTC](https://discourse.julialang.org/t/i-cant-add-the-package-dataframes-to-v-0-7-0-dev-3182-compiled-as-nongpl/7994 "2017-12-27T11:48:08Z")

</div>

Hello, When I tried to add the package DataFrames to Julia v"0.7.0-DEV.3182" compiled as nonGPL I got many warnings and errors in binaries.jl, dependencies.jl and bindeps.jl. To solve this I used “Nothing” instead of “…

---

## [Recommendation for logging?](https://discourse.julialang.org/t/recommendation-for-logging/4560)

<div class="topic-metadata">

**Author:** [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Replies:** 8\
**Last updated:** [December 27, 2017, 9:45am UTC](https://discourse.julialang.org/t/recommendation-for-logging/4560 "2017-12-27T09:45:48Z")

</div>

On https://pkg.julialang.org/ i find three logging packages: https://github.com/colinfang/MiniLogging.jl https://github.com/invenia/Memento.jl https://github.com/kmsquire/Logging.jl and then there is: https://github…

---

## [History Lesson Required About Type,Immutable,Struct, Mutable Struct](https://discourse.julialang.org/t/history-lesson-required-about-type-immutable-struct-mutable-struct/8021)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 3\
**Last updated:** [December 27, 2017, 9:20am UTC](https://discourse.julialang.org/t/history-lesson-required-about-type-immutable-struct-mutable-struct/8021 "2017-12-27T09:20:33Z")

</div>

Hi, I want to have a history lesson from a julia historian. type X end struct X end mutable X end immutable X end what are the differences? and how it appeared through the history. Thanks

---

## [Use Package (Add if Needed; Using)](https://discourse.julialang.org/t/use-package-add-if-needed-using/8004)

<div class="topic-metadata">

**Author:** [@ivo\_welch](https://discourse.julialang.org/u/ivo_welch)\
**Replies:** 1\
**Last updated:** [December 26, 2017, 7:34pm UTC](https://discourse.julialang.org/t/use-package-add-if-needed-using/8004 "2017-12-26T19:34:53Z")

</div>

Is it possible to define a function that tests if a package has been installed already, installs it if not yet so, and then invokes using. something like use(name) = try Pkg.installed(name) catch Pkg.add(name) end; usi…

---

## [What triggers a "must be explicitly imported" error?](https://discourse.julialang.org/t/what-triggers-a-must-be-explicitly-imported-error/7993)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 1\
**Last updated:** [December 26, 2017, 5:39pm UTC](https://discourse.julialang.org/t/what-triggers-a-must-be-explicitly-imported-error/7993 "2017-12-26T17:39:47Z")

</div>

Let’s say you have a couple example files: # woof.jl function println(foo::Module, bar::AbstractString) "cool. cool. alright" end println() = println(Main, "huh?") # bark.jl println(a::Float64, b::Integer, c::Stri…

---

## [RAII and wrapping a C library](https://discourse.julialang.org/t/raii-and-wrapping-a-c-library/7992)

<div class="topic-metadata">

**Author:** [@Bernard\_GODARD](https://discourse.julialang.org/u/Bernard_GODARD)\
**Replies:** 2\
**Last updated:** [December 26, 2017, 3:57pm UTC](https://discourse.julialang.org/t/raii-and-wrapping-a-c-library/7992 "2017-12-26T15:57:34Z")

</div>

There is an example in the Julia doc of constructing, destructing a GSL permutation object using ccall: https://docs.julialang.org/en/stable/manual/calling-c-and-fortran-code/#Some-Examples-of-C-Wrappers-1 In this exa…

---

## [Reference/Mutation Problem](https://discourse.julialang.org/t/reference-mutation-problem/7983)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 4\
**Last updated:** [December 26, 2017, 6:29am UTC](https://discourse.julialang.org/t/reference-mutation-problem/7983 "2017-12-26T06:29:35Z")

</div>

Hi guys I am trying to do the following: abstract type Operator end; mutable struct Multiply \<: Operator multiplier::Float64 end mutable struct Incrementor \<: Operator inc::Int end mutable struct CompositeOp \<:…

---

## [Dispatch on argument values rather than (just) types?](https://discourse.julialang.org/t/dispatch-on-argument-values-rather-than-just-types/7974)

<div class="topic-metadata">

**Author:** [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Replies:** 5\
**Last updated:** [December 26, 2017, 5:42am UTC](https://discourse.julialang.org/t/dispatch-on-argument-values-rather-than-just-types/7974 "2017-12-26T05:42:49Z")

</div>

Dear All, A rather broad question - I have cases where different algorithms are faster for different parameter values. I’d like to have a collection of different methods that are called according to some conditions. Ide…

---

## [Is there an equivalent of "from \<modul\> import \*" in PyCall?](https://discourse.julialang.org/t/is-there-an-equivalent-of-from-modul-import-in-pycall/7960)

<div class="topic-metadata">

**Author:** [@Nha\_Dinh\_Cao](https://discourse.julialang.org/u/Nha_Dinh_Cao)\
**Replies:** 2\
**Last updated:** [December 26, 2017, 1:53am UTC](https://discourse.julialang.org/t/is-there-an-equivalent-of-from-modul-import-in-pycall/7960 "2017-12-26T01:53:29Z")

</div>

Hello everyone, I have started using Julia and PyCall. I think that the @pyimport feature is very nice but sometimes I find it more useful if I can do something like “from import \*” like in Python. Is there any way I c…

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

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