# General Usage

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

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

**Page:** 656

---

## [Understanding few syntax of Julia code](https://discourse.julialang.org/t/understanding-few-syntax-of-julia-code/53514)

<div class="topic-metadata">

**Author:** [@Jared\_shay](https://discourse.julialang.org/u/Jared_shay)\
**Replies:** 21\
**Last updated:** [January 19, 2021, 7:12am UTC](https://discourse.julialang.org/t/understanding-few-syntax-of-julia-code/53514 "2021-01-19T07:12:45Z")

</div>

I am very new to Julia language, so I started to read the documentation and all builtin functions. Now, I am learning one github project for my work. Since I am more comfortable with Python, I tried to translate Julia’s …

---

## [Meta-programming an if-else statement of user-defined length](https://discourse.julialang.org/t/meta-programming-an-if-else-statement-of-user-defined-length/53525)

<div class="topic-metadata">

**Author:** [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Replies:** 17\
**Last updated:** [January 19, 2021, 7:07am UTC](https://discourse.julialang.org/t/meta-programming-an-if-else-statement-of-user-defined-length/53525 "2021-01-19T07:07:20Z")

</div>

I am trying to optimize the way my package SymbolicRegression.jl (the pure-Julia version of PySR) calls user-passed operators. The user passes a list of operators like so: SymbolicRegression.Options( binary\_operato…

---

## [Combine two graphs in lightgraph](https://discourse.julialang.org/t/combine-two-graphs-in-lightgraph/53462)

<div class="topic-metadata">

**Author:** [@AlexanderChen](https://discourse.julialang.org/u/AlexanderChen)\
**Replies:** 4\
**Last updated:** [January 19, 2021, 6:44am UTC](https://discourse.julialang.org/t/combine-two-graphs-in-lightgraph/53462 "2021-01-19T06:44:40Z")

</div>

Hi, I have two graphs that represent SQL tables : f = star\_graph(5) nodelabel = \["T1","C1","C2","C3","C4"\] h = star\_graph(4) nodelabel = \["T2","C1.2","C2.2","C3.2"\] I want to context both graphs on “C2” and “C3.2” h…

---

## [Macro for partially quoting (or partially evaluating) an expression](https://discourse.julialang.org/t/macro-for-partially-quoting-or-partially-evaluating-an-expression/53519)

<div class="topic-metadata">

**Author:** [@goretkin](https://discourse.julialang.org/u/goretkin)\
**Replies:** 5\
**Last updated:** [January 19, 2021, 1:35am UTC](https://discourse.julialang.org/t/macro-for-partially-quoting-or-partially-evaluating-an-expression/53519 "2021-01-19T01:35:08Z")

</div>

I would like to quote expressions, but evaluate some Symbols (which ones? see below). It should be possible to accomplish this using macros. I’ve tried to give an idea below of what I’m after: """ e.g. \`\`\`julia julia\> …

---

## [Changing file on disk not affecting IOStream data, is this a bug?](https://discourse.julialang.org/t/changing-file-on-disk-not-affecting-iostream-data-is-this-a-bug/53359)

<div class="topic-metadata">

**Author:** [@tlnagy](https://discourse.julialang.org/u/tlnagy)\
**Replies:** 11\
**Last updated:** [January 19, 2021, 12:23am UTC](https://discourse.julialang.org/t/changing-file-on-disk-not-affecting-iostream-data-is-this-a-bug/53359 "2021-01-19T00:23:35Z")

</div>

I’m extending my support for memory-mapped TIFF images in my package TiffImages.jl to support writing in addition to reading. One thing I’m running into is that my structs contain a file handle that I read/write to, but …

---

## [Low rank SVD](https://discourse.julialang.org/t/low-rank-svd/53529)

<div class="topic-metadata">

**Author:** [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Replies:** 3\
**Last updated:** [January 18, 2021, 8:53pm UTC](https://discourse.julialang.org/t/low-rank-svd/53529 "2021-01-18T20:53:18Z")

</div>

I need to calculate a low rank SVD of a large matrix for a pseudoinverse, but I also need the individual matrices. I currently do I like this: X\_svd = svd(X) r = 20 U = X\_svd.U\[:, 1:r\] Σ = Diagonal(X\_svd.S\[1:r\]) Vt = X…

---

## [How to add a package as a test dependency from the REPL?](https://discourse.julialang.org/t/how-to-add-a-package-as-a-test-dependency-from-the-repl/14313)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 3\
**Last updated:** [January 18, 2021, 8:04pm UTC](https://discourse.julialang.org/t/how-to-add-a-package-as-a-test-dependency-from-the-repl/14313 "2021-01-18T20:04:48Z")

</div>

To add a dependency ony for testing, I followed the instructions here: Pkg · The Julia Language. But this involves editing Project.toml directly. Can this be done through the REPL (like pkg\> add ... does for a proper de…

---

## [JSON list of lists to Julia matrix, preferably fast and with low memory overhead](https://discourse.julialang.org/t/json-list-of-lists-to-julia-matrix-preferably-fast-and-with-low-memory-overhead/53410)

<div class="topic-metadata">

**Author:** [@evanfields](https://discourse.julialang.org/u/evanfields)\
**Replies:** 5\
**Last updated:** [January 18, 2021, 8:01pm UTC](https://discourse.julialang.org/t/json-list-of-lists-to-julia-matrix-preferably-fast-and-with-low-memory-overhead/53410 "2021-01-18T20:01:51Z")

</div>

I have JSON files that contain a list of square matrices. Let’s say each JSON has a single key "mats" which is a list of list of lists. Each element in the outer list—i.e. a list of lists—is a matrix in row major order. …

---

## [Question on RefValue](https://discourse.julialang.org/t/question-on-refvalue/53498)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 12\
**Last updated:** [January 18, 2021, 3:48pm UTC](https://discourse.julialang.org/t/question-on-refvalue/53498 "2021-01-18T15:48:55Z")

</div>

In this video here the lecturer defines a composite type to hold his model and to step it forward in time. He needs to keep track of the number of iterations but the number of iterations is a field within a struct which…

---

## [How to change x label when boxplotting different dataframes](https://discourse.julialang.org/t/how-to-change-x-label-when-boxplotting-different-dataframes/53542)

<div class="topic-metadata">

**Author:** [@HelgavonLichtenstein](https://discourse.julialang.org/u/HelgavonLichtenstein)\
**Replies:** 0\
**Last updated:** [January 18, 2021, 2:02pm UTC](https://discourse.julialang.org/t/how-to-change-x-label-when-boxplotting-different-dataframes/53542 "2021-01-18T14:02:30Z")

</div>

Hello, using Julia 1.5 on Atom, I want to make a boxplot comparing values from different dataframes. It is almost how I want it, but the x label needs to be fixed and I can’t figure it out. I used the series plot recipe,…

---

## [Associating arguments with partial functions to simplify nesting](https://discourse.julialang.org/t/associating-arguments-with-partial-functions-to-simplify-nesting/53457)

<div class="topic-metadata">

**Author:** [@billykalfus](https://discourse.julialang.org/u/billykalfus)\
**Replies:** 12\
**Last updated:** [January 18, 2021, 1:28pm UTC](https://discourse.julialang.org/t/associating-arguments-with-partial-functions-to-simplify-nesting/53457 "2021-01-18T13:28:51Z")

</div>

Suppose I have some nested functions, and the lowest level function has some arguments which are caches and/or outputs whose values need to be written to and retained between calls: function a!(arg1, arg2) b!(arg1, …

---

## [Why is this CUDA.jl code slow?](https://discourse.julialang.org/t/why-is-this-cuda-jl-code-slow/53538)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 0\
**Last updated:** [January 18, 2021, 12:47pm UTC](https://discourse.julialang.org/t/why-is-this-cuda-jl-code-slow/53538 "2021-01-18T12:47:27Z")

</div>

Background I am trying to implement a custom layer for a Flux.jl network (please point out if this exists already somewhere). What the layer should do is apply a 1x1x1 convolution to the concatenation of a bunch of tenso…

---

## [Creating a macro to broadcast in parallel](https://discourse.julialang.org/t/creating-a-macro-to-broadcast-in-parallel/53508)

<div class="topic-metadata">

**Author:** [@s-kap](https://discourse.julialang.org/u/s-kap)\
**Replies:** 5\
**Last updated:** [January 18, 2021, 9:57am UTC](https://discourse.julialang.org/t/creating-a-macro-to-broadcast-in-parallel/53508 "2021-01-18T09:57:06Z")

</div>

Hey all, I’m trying to create a macro to broadcast in parallel. I have a large dataframe and I frequently create new columns based on values from old columns. Let’s take string concatenation for example. The non paral…

---

## [Pluto Markdown Not Working](https://discourse.julialang.org/t/pluto-markdown-not-working/53433)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 8\
**Last updated:** [January 18, 2021, 7:12am UTC](https://discourse.julialang.org/t/pluto-markdown-not-working/53433 "2021-01-18T07:12:54Z")

</div>

Hello, I am trying to emulate the markdown in the Pluto NB shown here. Here’s what it looks like in my notebook. begin Cmin=10.0; Cmax=200.; Cslider = @bind SlideValC Slider(Cmin:0.1:Cmax, default=51); md" $(Cmin) …

---

## [Dealing with leap years](https://discourse.julialang.org/t/dealing-with-leap-years/53516)

<div class="topic-metadata">

**Author:** [@askvorts](https://discourse.julialang.org/u/askvorts)\
**Replies:** 1\
**Last updated:** [January 18, 2021, 5:54am UTC](https://discourse.julialang.org/t/dealing-with-leap-years/53516 "2021-01-18T05:54:06Z")

</div>

I am trying to find a package that deals with leap years. For example a function that returns the number of days that fall on 29 February for some period. (There are some complications: years such that mod(year,100)==0 a…

---

## [Inference on field types?](https://discourse.julialang.org/t/inference-on-field-types/53448)

<div class="topic-metadata">

**Author:** [@tamasgal](https://discourse.julialang.org/u/tamasgal)\
**Replies:** 10\
**Last updated:** [January 18, 2021, 12:47am UTC](https://discourse.julialang.org/t/inference-on-field-types/53448 "2021-01-18T00:47:38Z")

</div>

I often have to “categorise” a vector of struct elements by a specific field and I wanted to get rid of some duplicated logic and generalise the categorisation, however I hit the penalty of runtime (dynamic) lookup of th…

---

## [Ccall: how to wrap call-by-reference C functions?](https://discourse.julialang.org/t/ccall-how-to-wrap-call-by-reference-c-functions/53510)

<div class="topic-metadata">

**Author:** [@simon-anders](https://discourse.julialang.org/u/simon-anders)\
**Replies:** 3\
**Last updated:** [January 18, 2021, 1:39am UTC](https://discourse.julialang.org/t/ccall-how-to-wrap-call-by-reference-c-functions/53510 "2021-01-18T01:39:36Z")

</div>

Hi I’m trying to wrap a C library, and I can’t figure out how references are handled in ccall. Here is my study case: I have a simple C file, called jlptrtest.c, consisting of just this: void put\_7( int \*i ) { \*i =…

---

## [Resolving package identifier ... as a directory](https://discourse.julialang.org/t/resolving-package-identifier-as-a-directory/53499)

<div class="topic-metadata">

**Author:** [@Marco-Congedo](https://discourse.julialang.org/u/Marco-Congedo)\
**Replies:** 5\
**Last updated:** [January 17, 2021, 10:57pm UTC](https://discourse.julialang.org/t/resolving-package-identifier-as-a-directory/53499 "2021-01-17T22:57:25Z")

</div>

Hello, i am creating a new package A. After i ativate it, i add another package B i already wrote and published. I get this: (A) pkg\> add B \[ Info: Resolving package identifier \`B\` as a directory at \`C:\\Users\\congedom\\…

---

## [Colored markdown section with Pluto.jl](https://discourse.julialang.org/t/colored-markdown-section-with-pluto-jl/53497)

<div class="topic-metadata">

**Author:** [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Replies:** 2\
**Last updated:** [January 17, 2021, 8:13pm UTC](https://discourse.julialang.org/t/colored-markdown-section-with-pluto-jl/53497 "2021-01-17T20:13:47Z")

</div>

In Pluto.jl, is there any way to create colored Markdown “tips” or “notes”, as shown in Julia’s Markdown Documentation? I think I’ve seen some Pluto notebooks on course channels on YouTube (mainly MIT courses), but I’m n…

---

## [Using Makie on Ubuntu 18.04](https://discourse.julialang.org/t/using-makie-on-ubuntu-18-04/53164)

<div class="topic-metadata">

**Author:** [@Josiah\_Slack](https://discourse.julialang.org/u/Josiah_Slack)\
**Replies:** 3\
**Last updated:** [January 17, 2021, 5:02pm UTC](https://discourse.julialang.org/t/using-makie-on-ubuntu-18-04/53164 "2021-01-17T17:02:26Z")

</div>

I’m running with 1.5.1 and am not having much luck following the “quick start” instructions in the README for Makie.jl (“add Makie; test Makie”). I started off with a clean environment and added Makie.jl to it. After the…

---

## [Fortran ccall variables persisting in the background](https://discourse.julialang.org/t/fortran-ccall-variables-persisting-in-the-background/53454)

<div class="topic-metadata">

**Author:** [@lamorton](https://discourse.julialang.org/u/lamorton)\
**Replies:** 3\
**Last updated:** [January 17, 2021, 2:01pm UTC](https://discourse.julialang.org/t/fortran-ccall-variables-persisting-in-the-background/53454 "2021-01-17T14:01:03Z")

</div>

I wrote the following Fortran wrapper around an existing Fortran library that defines some ‘global’ parameters that persist between subroutines. General idea is that libfida defines a subroutine read\_tables that loads s…

---

## [Running a function is extremely slow](https://discourse.julialang.org/t/running-a-function-is-extremely-slow/53475)

<div class="topic-metadata">

**Author:** [@cheng\_chen](https://discourse.julialang.org/u/cheng_chen)\
**Replies:** 1\
**Last updated:** [January 17, 2021, 9:32am UTC](https://discourse.julialang.org/t/running-a-function-is-extremely-slow/53475 "2021-01-17T09:32:59Z")

</div>

I wrote a Julia function and on the first line inside the function, I had a print statement. After I call the function in REPL, It takes a long time for it to get to the first line of the function. Does anyone know what …

---

## [Fama–MacBeth Regression in Julia](https://discourse.julialang.org/t/fama-macbeth-regression-in-julia/53460)

<div class="topic-metadata">

**Author:** [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Replies:** 2\
**Last updated:** [January 17, 2021, 8:23am UTC](https://discourse.julialang.org/t/fama-macbeth-regression-in-julia/53460 "2021-01-17T08:23:38Z")

</div>

I know how to do Fama-MacBeth Regression in R but could not figure out how to do it in Julia. Need some help here.

---

## [CSV.read() error please provide a valid sink argument](https://discourse.julialang.org/t/csv-read-error-please-provide-a-valid-sink-argument/53437)

<div class="topic-metadata">

**Author:** [@tonyhur](https://discourse.julialang.org/u/tonyhur)\
**Replies:** 3\
**Last updated:** [January 17, 2021, 8:03am UTC](https://discourse.julialang.org/t/csv-read-error-please-provide-a-valid-sink-argument/53437 "2021-01-17T08:03:57Z")

</div>

Hello I anm new here. I work through the real great book “Julia Quick syntax reference” from Antonello Lobianco. I typed a code from page 183. What is wrong with d\_table = CSV.read(IOBuffer(“”" plants new-york chic…

---

## [Non-deterministic segfault (only triggered on GitHub Actions). Tips for debugging?](https://discourse.julialang.org/t/non-deterministic-segfault-only-triggered-on-github-actions-tips-for-debugging/53367)

<div class="topic-metadata">

**Author:** [@vlandau](https://discourse.julialang.org/u/vlandau)\
**Replies:** 10\
**Last updated:** [January 16, 2021, 10:54pm UTC](https://discourse.julialang.org/t/non-deterministic-segfault-only-triggered-on-github-actions-tips-for-debugging/53367 "2021-01-16T22:54:28Z")

</div>

I’m encountering a strange segfault error in my package tests that appears to be non-deterministic, and is only triggered during CI with GitHub Actions. I’m not able to reproduce locally. This issue is occurring on MacO…

---

## [Broadcasting in TensorOperations.jl (and applying ForwardDiff)](https://discourse.julialang.org/t/broadcasting-in-tensoroperations-jl-and-applying-forwarddiff/53421)

<div class="topic-metadata">

**Author:** [@bhaveshshrimali](https://discourse.julialang.org/u/bhaveshshrimali)\
**Replies:** 4\
**Last updated:** [January 16, 2021, 9:38pm UTC](https://discourse.julialang.org/t/broadcasting-in-tensoroperations-jl-and-applying-forwarddiff/53421 "2021-01-16T21:38:22Z")

</div>

Hi everyone, \[Edit\] Question 1: I had a quick question regarding the usage of TensorOperations.jl. How would one go about broadcasting certain operations such as using TensorOperations; function g(F) @tensor F\[i,j\]…

---

## [Use IJulia after updating Julia version](https://discourse.julialang.org/t/use-ijulia-after-updating-julia-version/53444)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 8\
**Last updated:** [January 16, 2021, 8:17pm UTC](https://discourse.julialang.org/t/use-ijulia-after-updating-julia-version/53444 "2021-01-16T20:17:09Z")

</div>

I would like to use IJulia notebook with Julia 1.6.0 beta1. However, it does not show up in the list of available kernels. Is there a way to add it to the list? Thanks!

---

## [Julia on Cluster with SSH Restriction](https://discourse.julialang.org/t/julia-on-cluster-with-ssh-restriction/11823)

<div class="topic-metadata">

**Author:** [@brossetti](https://discourse.julialang.org/u/brossetti)\
**Replies:** 18\
**Last updated:** [January 16, 2021, 7:25pm UTC](https://discourse.julialang.org/t/julia-on-cluster-with-ssh-restriction/11823 "2021-01-16T19:25:05Z")

</div>

I’m attempting to use Julia on a cluster (using PBS) that blocks ssh connections to anything except the head node. Based on the documentation, it seems that Julia requires passwordless ssh to start workers on cluster nod…

---

## [Extending function from Base](https://discourse.julialang.org/t/extending-function-from-base/53414)

<div class="topic-metadata">

**Author:** [@mr.red](https://discourse.julialang.org/u/mr.red)\
**Replies:** 5\
**Last updated:** [January 16, 2021, 4:11pm UTC](https://discourse.julialang.org/t/extending-function-from-base/53414 "2021-01-16T16:11:56Z")

</div>

The function Base.binomial(n, k) has 3 different calling patterns: julia\> methods(Base.binomial) # 3 methods for generic function "binomial": \[1\] binomial(n::BigInt, k::UInt64) in Base.GMP at gmp.jl:641 \[2\] binomial(n::…

---

## [Installing package seems to update everything unintentionally?](https://discourse.julialang.org/t/installing-package-seems-to-update-everything-unintentionally/25134)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 17\
**Last updated:** [January 16, 2021, 3:40pm UTC](https://discourse.julialang.org/t/installing-package-seems-to-update-everything-unintentionally/25134 "2021-01-16T15:40:14Z")

</div>

I was under the impression that installing a new package should not update any existing packages, unless this is required to satisfy dependencies. Nevertheless, I feel like this is what happens whenever I install anythin…

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

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