# General Usage

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

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

**Page:** 972

---

## [Using iterator in Julia 0.7](https://discourse.julialang.org/t/using-iterator-in-julia-0-7/11546)

<div class="topic-metadata">

**Author:** [@00vareladavid](https://discourse.julialang.org/u/00vareladavid)\
**Replies:** 2\
**Last updated:** [June 8, 2018, 7:12pm UTC](https://discourse.julialang.org/t/using-iterator-in-julia-0-7/11546 "2018-06-08T19:12:14Z")

</div>

I’m trying to implement the iterator interface on a toy linked list implementation. I believe I’m getting it right, but I keep getting an error I don’t know how to handle. I’m using this reference. I tried unsuccessfully…

---

## [Hdf5read inputs](https://discourse.julialang.org/t/hdf5read-inputs/11513)

<div class="topic-metadata">

**Author:** [@VDC](https://discourse.julialang.org/u/VDC)\
**Replies:** 2\
**Last updated:** [June 8, 2018, 5:24pm UTC](https://discourse.julialang.org/t/hdf5read-inputs/11513 "2018-06-08T17:24:49Z")

</div>

Hello, everyone! Have a question regarding hdf5 package in Julia, specifically the hdf5read function? I see this in the main page of the github A = collect(reshape(1:120, 15, 8)) h5write(“/tmp/test2.h5”, “mygroup2/A”…

---

## [Equivalent of .juliarc.jl in v0.7](https://discourse.julialang.org/t/equivalent-of-juliarc-jl-in-v0-7/11534)

<div class="topic-metadata">

**Author:** [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Replies:** 5\
**Last updated:** [June 8, 2018, 4:19pm UTC](https://discourse.julialang.org/t/equivalent-of-juliarc-jl-in-v0-7/11534 "2018-06-08T16:19:59Z")

</div>

I noticed that Julia does not execute .juliarc.jl on startup (I am using Windows10). Has this functionality been replaced, or do I need to enable it somewhere?

---

## [Maybe do not throw "invalid escape sequence" for docstrings (v0.7)](https://discourse.julialang.org/t/maybe-do-not-throw-invalid-escape-sequence-for-docstrings-v0-7/11536)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 3\
**Last updated:** [June 8, 2018, 12:45pm UTC](https://discourse.julialang.org/t/maybe-do-not-throw-invalid-escape-sequence-for-docstrings-v0-7/11536 "2018-06-08T12:45:03Z")

</div>

I have some cases where I have invalid escape sequences in docstrings. This is caused by using \\\_ because the Atom syntax highlighter breaks without them. I understand that this is an editor bug, but I still don’t see th…

---

## [Trouble Compilng v0.6.3 (SuiteSparse fails?)](https://discourse.julialang.org/t/trouble-compilng-v0-6-3-suitesparse-fails/11532)

<div class="topic-metadata">

**Author:** [@cortner](https://discourse.julialang.org/u/cortner)\
**Replies:** 1\
**Last updated:** [June 8, 2018, 11:59am UTC](https://discourse.julialang.org/t/trouble-compilng-v0-6-3-suitesparse-fails/11532 "2018-06-08T11:59:51Z")

</div>

I print below the error message. This is on Mac OS X with Fuji-2:julia63 ortner$ clang -v Apple LLVM version 9.1.0 (clang-902.0.39.2) Target: x86\_64-apple-darwin17.5.0 Thread model: posix InstalledDir: /Library/Develope…

---

## [@show displays spurious information?](https://discourse.julialang.org/t/show-displays-spurious-information/11524)

<div class="topic-metadata">

**Author:** [@dpo](https://discourse.julialang.org/u/dpo)\
**Replies:** 4\
**Last updated:** [June 8, 2018, 1:43am UTC](https://discourse.julialang.org/t/show-displays-spurious-information/11524 "2018-06-08T01:43:10Z")

</div>

Sorry if this is a silly question but I don’t recall @show displaying spurious information like the following illustrates. Is that really the intended behavior? \_ \_ \_(\_)\_ | A fresh approach to technical co…

---

## [Help understanding vectorization (or lack thereof)](https://discourse.julialang.org/t/help-understanding-vectorization-or-lack-thereof/11518)

<div class="topic-metadata">

**Author:** [@raminammour](https://discourse.julialang.org/u/raminammour)\
**Replies:** 15\
**Last updated:** [June 8, 2018, 12:00am UTC](https://discourse.julialang.org/t/help-understanding-vectorization-or-lack-thereof/11518 "2018-06-08T00:00:55Z")

</div>

Hello, I have these simple functions, one with @simd and one without: @noinline function msum(x) s=zero(eltype(x)) for i in 1:length(x) @inbounds s+=x\[i\] end s end @noinline…

---

## [Performance details of StaticArray](https://discourse.julialang.org/t/performance-details-of-staticarray/11506)

<div class="topic-metadata">

**Author:** [@Gyslain](https://discourse.julialang.org/u/Gyslain)\
**Replies:** 5\
**Last updated:** [June 7, 2018, 11:04pm UTC](https://discourse.julialang.org/t/performance-details-of-staticarray/11506 "2018-06-07T23:04:39Z")

</div>

Hello! In the StaticArray documentation, we read : The speed of small SVectors, SMatrixs and SArrays is often \> 10 × faster than Base.Array These results improve significantly when using julia -O3 with immutable stati…

---

## [Fewer processes in @parallel macro](https://discourse.julialang.org/t/fewer-processes-in-parallel-macro/11521)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 0\
**Last updated:** [June 7, 2018, 8:27pm UTC](https://discourse.julialang.org/t/fewer-processes-in-parallel-macro/11521 "2018-06-07T20:27:08Z")

</div>

I have a large worker pool but occasionally I do not want to utilize all workers. Is there any way to make it use fewer processes with the @parallel macro? Or should I use some other parallel processing functions?

---

## [Using loop variable as an input for a macro function](https://discourse.julialang.org/t/using-loop-variable-as-an-input-for-a-macro-function/11516)

<div class="topic-metadata">

**Author:** [@bkang119](https://discourse.julialang.org/u/bkang119)\
**Replies:** 3\
**Last updated:** [June 7, 2018, 6:45pm UTC](https://discourse.julialang.org/t/using-loop-variable-as-an-input-for-a-macro-function/11516 "2018-06-07T18:45:16Z")

</div>

Hi, I have a simple question on macro function. Let say I have a macro function macro add\_one(i::Int64) i+1 end which does the simple thing: @add\_one 1 gives 2 as expected. Then I want to use the function inside t…

---

## [Proper parameter type for a scalar or array of numbers](https://discourse.julialang.org/t/proper-parameter-type-for-a-scalar-or-array-of-numbers/11514)

<div class="topic-metadata">

**Author:** [@Zhong\_Pan](https://discourse.julialang.org/u/Zhong_Pan)\
**Replies:** 4\
**Last updated:** [June 7, 2018, 6:15pm UTC](https://discourse.julialang.org/t/proper-parameter-type-for-a-scalar-or-array-of-numbers/11514 "2018-06-07T18:15:24Z")

</div>

I’m using JuliaPro 0.6.2. In numerical algorithms for engineering, I often write functions with input parameters that could be a scalar or an Array (1D Vector or 2D Matrix) of any kind of Number - it could be Int, Real,…

---

## [V0.7: "first argument not a pointer or valid constant expression" in ccall](https://discourse.julialang.org/t/v0-7-first-argument-not-a-pointer-or-valid-constant-expression-in-ccall/11502)

<div class="topic-metadata">

**Author:** [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)\
**Replies:** 2\
**Last updated:** [June 7, 2018, 5:14pm UTC](https://discourse.julialang.org/t/v0-7-first-argument-not-a-pointer-or-valid-constant-expression-in-ccall/11502 "2018-06-07T17:14:14Z")

</div>

Is this a bug or a feature ? module B using Cairo test() = ccall((:cairo\_version\_string,Cairo.\_jl\_libcairo),Cstring,()) end julia\> B.test() ERROR: TypeError: in test, in ccall: first argument not a pointer or…

---

## [How to reference modules from current package (v0.7)](https://discourse.julialang.org/t/how-to-reference-modules-from-current-package-v0-7/11454)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 8\
**Last updated:** [June 7, 2018, 5:07pm UTC](https://discourse.julialang.org/t/how-to-reference-modules-from-current-package-v0-7/11454 "2018-06-07T17:07:13Z")

</div>

This worked perfectly on v0.6 but no longer works on v0.7 and I can’t understand why. Say I have a package, Foo with the following structure: Foo/src/Foo.jl Foo/src/Bar.jl In Foo.jl I have push!(LOAD\_PATH, @\_\_DIR\_\_) …

---

## [Is there a trick to perform "run until line xxx" in ASTInterpreter2?](https://discourse.julialang.org/t/is-there-a-trick-to-perform-run-until-line-xxx-in-astinterpreter2/11511)

<div class="topic-metadata">

**Author:** [@Zhong\_Pan](https://discourse.julialang.org/u/Zhong_Pan)\
**Replies:** 0\
**Last updated:** [June 7, 2018, 4:03pm UTC](https://discourse.julialang.org/t/is-there-a-trick-to-perform-run-until-line-xxx-in-astinterpreter2/11511 "2018-06-07T16:03:02Z")

</div>

Currently Juno has this nice debugging GUI that integrates with ASTInterpreter2. However, sometimes I’m just using a simple Julia console and still want to do step-through debugging. I know I should do “using ASTInterpr…

---

## [Generate nested for loops using metaprogramming?](https://discourse.julialang.org/t/generate-nested-for-loops-using-metaprogramming/8247)

<div class="topic-metadata">

**Author:** [@onetonfoot](https://discourse.julialang.org/u/onetonfoot)\
**Replies:** 4\
**Last updated:** [June 7, 2018, 3:20pm UTC](https://discourse.julialang.org/t/generate-nested-for-loops-using-metaprogramming/8247 "2018-06-07T15:20:39Z")

</div>

Given a set of characters and a number I’m trying to generate all possible sequences. For example, given “ACTG” to generate all possible sequences of length 2 I could do. letters = "ACTG" for i in letters for j in…

---

## [Version number in packages with Pkg.clone()](https://discourse.julialang.org/t/version-number-in-packages-with-pkg-clone/11499)

<div class="topic-metadata">

**Author:** [@jarl](https://discourse.julialang.org/u/jarl)\
**Replies:** 4\
**Last updated:** [June 7, 2018, 1:33pm UTC](https://discourse.julialang.org/t/version-number-in-packages-with-pkg-clone/11499 "2018-06-07T13:33:42Z")

</div>

I’m developing a package and would like to give it version numbers. I don’t want to register it on julias official METADATA yet so Pkg.clone()-support seems like a reasonable solution. Is it still possible to add versio…

---

## [Is there an available plotting package for 0.7-alpha?](https://discourse.julialang.org/t/is-there-an-available-plotting-package-for-0-7-alpha/11493)

<div class="topic-metadata">

**Author:** [@111](https://discourse.julialang.org/u/111)\
**Replies:** 4\
**Last updated:** [June 7, 2018, 12:35pm UTC](https://discourse.julialang.org/t/is-there-an-available-plotting-package-for-0-7-alpha/11493 "2018-06-07T12:35:29Z")

</div>

I tried Plots, PyPlots, which didn’t pass the package building. GR did, but an error occured when performing a simple plot, and the error message is: ERROR: error compiling #plot#19: error compiling plot\_data: error com…

---

## [Creating modules in Julia v0.7-alpha](https://discourse.julialang.org/t/creating-modules-in-julia-v0-7-alpha/11475)

<div class="topic-metadata">

**Author:** [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Replies:** 12\
**Last updated:** [June 7, 2018, 11:56am UTC](https://discourse.julialang.org/t/creating-modules-in-julia-v0-7-alpha/11475 "2018-06-07T11:56:15Z")

</div>

I’m very confused on how to create a new module in Julia v0.7. Even the following doesn’t work: julia\> module Foo end Main.Foo julia\> using Foo ERROR: ArgumentError: Module Foo not found in current path. Run \`Pk…

---

## [Take action based on Distribution type in a type stable way?](https://discourse.julialang.org/t/take-action-based-on-distribution-type-in-a-type-stable-way/11487)

<div class="topic-metadata">

**Author:** [@gabrielgellner](https://discourse.julialang.org/u/gabrielgellner)\
**Replies:** 2\
**Last updated:** [June 7, 2018, 1:43am UTC](https://discourse.julialang.org/t/take-action-based-on-distribution-type-in-a-type-stable-way/11487 "2018-06-07T01:43:59Z")

</div>

I want to make a function that transforms some information given what kind of Distributions type a variable has. Something like: tdist = typeof(prob.dist) if tdist == Distributions.Gamma{Float64} par\_transform\[i\] =…

---

## [Juno/Atom editor](https://discourse.julialang.org/t/juno-atom-editor/11463)

<div class="topic-metadata">

**Author:** [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Replies:** 2\
**Last updated:** [June 6, 2018, 9:52pm UTC](https://discourse.julialang.org/t/juno-atom-editor/11463 "2018-06-06T21:52:06Z")

</div>

I’m looking for tips on managing open files in Juno/Atom. I have a project where I like to have lots of files open. These files are grouped into a sets (say 5-6 sets each of 4-6 files). Currently I have a pane for each …

---

## [Memory allocations when returning vectors](https://discourse.julialang.org/t/memory-allocations-when-returning-vectors/11438)

<div class="topic-metadata">

**Author:** [@Maurizio\_Tomasi](https://discourse.julialang.org/u/Maurizio_Tomasi)\
**Replies:** 15\
**Last updated:** [June 6, 2018, 9:26pm UTC](https://discourse.julialang.org/t/memory-allocations-when-returning-vectors/11438 "2018-06-06T21:26:52Z")

</div>

I am trying to understand what is the best strategy to initialize arrays in Julia. Consider this small example: using BenchmarkTools function f(theta) \[cos(theta) \* sin(theta), sin(theta), 1.0\] end function g(thet…

---

## [Int v UInt](https://discourse.julialang.org/t/int-v-uint/11484)

<div class="topic-metadata">

**Author:** [@00vareladavid](https://discourse.julialang.org/u/00vareladavid)\
**Replies:** 4\
**Last updated:** [June 6, 2018, 9:06pm UTC](https://discourse.julialang.org/t/int-v-uint/11484 "2018-06-06T21:06:40Z")

</div>

Is there any reason Int, and not UInt, is the canonical type for sizes? E.g. typeof(length(some\_array)) is Int.

---

## [Remove additional rule that parameters must match for dispatch](https://discourse.julialang.org/t/remove-additional-rule-that-parameters-must-match-for-dispatch/11482)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 2\
**Last updated:** [June 6, 2018, 8:27pm UTC](https://discourse.julialang.org/t/remove-additional-rule-that-parameters-must-match-for-dispatch/11482 "2018-06-06T20:27:16Z")

</div>

https://github.com/JuliaLang/julia/pull/23117 Can someone tell what this change brings? Can you show me an example what it enabled? Thanks

---

## [Gadfly problem plotting](https://discourse.julialang.org/t/gadfly-problem-plotting/11466)

<div class="topic-metadata">

**Author:** [@Guito](https://discourse.julialang.org/u/Guito)\
**Replies:** 2\
**Last updated:** [June 6, 2018, 2:59pm UTC](https://discourse.julialang.org/t/gadfly-problem-plotting/11466 "2018-06-06T14:59:54Z")

</div>

Hi everyone, I’m starting with gadfly and I can’t undestand how to print the variable values, I mean. if I want to print an array like p = \[1,2,3\] Using gadfly My plot = plot( x=1:3,y=p) and I can do it without prob…

---

## [pmap usage pmap(xxxx,i) where i is large than nprocs](https://discourse.julialang.org/t/pmap-usage-pmap-xxxx-i-where-i-is-large-than-nprocs/11470)

<div class="topic-metadata">

**Author:** [@ersoacc](https://discourse.julialang.org/u/ersoacc)\
**Replies:** 0\
**Last updated:** [June 6, 2018, 1:27pm UTC](https://discourse.julialang.org/t/pmap-usage-pmap-xxxx-i-where-i-is-large-than-nprocs/11470 "2018-06-06T13:27:51Z")

</div>

Hello. I use pmap to calculate Jacobian matrix by multi-colored finite differences. My Jacobians are large and sparse. Thus, there are approximately 18 colors. Following is the line that computes all colors(colums). J…

---

## [Square roots of integers](https://discourse.julialang.org/t/square-roots-of-integers/11448)

<div class="topic-metadata">

**Author:** [@Bernard\_GODARD](https://discourse.julialang.org/u/Bernard_GODARD)\
**Replies:** 14\
**Last updated:** [June 6, 2018, 1:13pm UTC](https://discourse.julialang.org/t/square-roots-of-integers/11448 "2018-06-06T13:13:36Z")

</div>

I need a function that returns the square root of a positive integer less than Nmax but does the computation only once for a given integer. In C, I would compute all values on the first call using a static variable like…

---

## [Rand and rand! seem inconsistent](https://discourse.julialang.org/t/rand-and-rand-seem-inconsistent/11460)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 3\
**Last updated:** [June 6, 2018, 6:41am UTC](https://discourse.julialang.org/t/rand-and-rand-seem-inconsistent/11460 "2018-06-06T06:41:38Z")

</div>

Clearly i’m missing something… julia\> rand(UInt8(0):UInt8(15)) 0x02 julia\> rand!(UInt8(0):UInt8(15), zeros(UInt8,5)) ERROR: indexing not defined for UnitRange{UInt8} Stacktrace: \[1\] setindex! at ./abstractarray.jl:967…

---

## [Basic questions for migrating a script to 0.7](https://discourse.julialang.org/t/basic-questions-for-migrating-a-script-to-0-7/11461)

<div class="topic-metadata">

**Author:** [@jocklawrie](https://discourse.julialang.org/u/jocklawrie)\
**Replies:** 0\
**Last updated:** [June 6, 2018, 6:19am UTC](https://discourse.julialang.org/t/basic-questions-for-migrating-a-script-to-0-7/11461 "2018-06-06T06:19:08Z")

</div>

Hi all, I have a private package located at /home/jock/repos/private/MyPkg.jl. Among other things it contains scripts/backtest, which is executable. It looks like this: #! /usr/bin/env julia using DataFrames using M…

---

## [Article on Packaging and Notebooks](https://discourse.julialang.org/t/article-on-packaging-and-notebooks/11459)

<div class="topic-metadata">

**Author:** [@johnh](https://discourse.julialang.org/u/johnh)\
**Replies:** 0\
**Last updated:** [June 6, 2018, 5:28am UTC](https://discourse.julialang.org/t/article-on-packaging-and-notebooks/11459 "2018-06-06T05:28:21Z")

</div>

A very good article from The Next Platform Quote: However, one of the bigger challenge is in the interpreted language space, Each of R, node, go, ruby, python, etc. each also have their own integrated and bespoke embed…

---

## [0.7 "projects" and "applications" -- how to use?](https://discourse.julialang.org/t/0-7-projects-and-applications-how-to-use/11443)

<div class="topic-metadata">

**Author:** [@Stephen\_Vavasis](https://discourse.julialang.org/u/Stephen_Vavasis)\
**Replies:** 3\
**Last updated:** [June 6, 2018, 3:25am UTC](https://discourse.julialang.org/t/0-7-projects-and-applications-how-to-use/11443 "2018-06-06T03:25:29Z")

</div>

The new 0.7.0-alpha manual section on the package manager introduces the concepts of “project” and “application”-- I presume that these are meant for ordinary users trying to develop their own code? In this case, I have…

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

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