Quantcast
Channel: First steps - JuliaLang
Browsing all 2795 articles
Browse latest View live

Any performance issues with multiple dispatch?

Hi! I have some functions in a loop that get called a huge number of times. Some of them have two different forms, one when my elements are triangles and on when they are quads. Normally, I’d write...

View Article


Macro behavior depends on method of code loading?

I have two identical versions of a macro that prints all exported names of a given module. One version is imported from a package; the other is defined globally. The former fails while the latter...

View Article


Problem registering package in general registry

Hi, I’m trying to submit my first package to the general registry through JuliaHub and it keeps on failing on the auto merge step. The package url I entered is: GitHub - HapponomyOrg/EconoSim.jl:...

View Article

Parsing multipart data using HTTP.jl

I’m looking for standard function which can parse body from multipart request. I received json and csv in one multipart request. How can I parse it? Following example is received in one multipart...

View Article

Fail to run shell command

Hei, In Julia 1.4, in Atom-IDE’s REPL, Windows, Julia and I have the following dialog julia> run(`echo hello`) ERROR: IOError: could not spawn `echo hello`: no such file or directory (ENOENT)...

View Article


Functional programming in Julia

I’m recently interested in functional programming (FP) style. I sometimes felt that Julia has probably been inspired by FP but it seems that Julia does not officially provide FP tools, for example,...

View Article

Scalar contained by vector of StaticArrays

Hi! I want to check if an integer is contained by a vector of StaticArrays. Here’s an example (with regular arrays, but it’s the same issue). a = [[1,2], [3,4]] 1 in a # false I guess I could write a...

View Article

Documentation for shell mode?

I really like the REPL’s shell mode (the thing you get after typing ;). But I struggle with understanding which features of my normal $SHELL are available, and which don’t work. I’ve read the official...

View Article


Is there a way to separate development dependencies from runtime dependencies...

Suppose I’m working on a project that depends on DataFrames.jl and Gadfly.jl to run and I decide to work on it using Pluto.jl or IJulia.jl. As far as I know, I can create Pkg.activate an environment...

View Article


Generating an ngram document term matrix with TextAnalysis.jl

Hello, I’m currently trying to use TextAnalysis.jl for the first time, and I can’t figure out this problem. I can tokenize a string like so: using TextAnalysis test = "Hello, I like apples and...

View Article

Reference to the value of a named function argument

Within a function body I’d like to refer to a value of a named argument. An example of what I have in mind, how to implement f: function f(; arg1, arg2, argname) println("value of $argname is: ???")...

View Article

Running Julia on remote machine

Frequently I run code on a remote machine which means executing at the command line. But every time I run a code in Julia it’s going to recompile everything and so it takes longer. Is there a way to...

View Article

The macrocall @__FILE__ does not return the directory of the file, but rather...

I have been using to following to change my working directory to the location of my .jl scripts in Atom as follows without problems: cd(dirname(@__FILE__)) When I run a script with this in vs code, I...

View Article


Performance tips on turning arrays into tuples

Hello, I have some Vectors of StaticArrays and I use them in functions like this: fun(vec[1],vec[2],vec[3]) where each position of vec is a StaticArray. It would be helpful to do something like this:...

View Article

Modify `r`th largest entry of vector in place

I can use sortperm() to get a permutation index that puts a in order: 3-element Array{Float64,1}: 0.9546235783735173 0.15267335513843228 0.3175124947454555 julia> order = sortperm(a) 3-element...

View Article


How to access values in TimeArrays cells

Following what can be done in DataFrames, for example, using DataFrames, TimeSeries A = [1,2,3] B = [3,4,5] C = DataFrame(A=A, B=B) C[1,2] == 3 # true typeof(C[1,2]) # Int64 I am trying to access...

View Article

How to create a (n-1) dimensional view of a n dimensional array in a general...

For the n-dimensional array, I can do it separately A[:, 1] # for 2D A[:, :, 1] # for 3D A[:, :, :, 1] # for 4D but how can I do it generally if n is not known in advance? i.e. the number of colons is...

View Article


Determining whether two methods are both extensions of the same function?

I have two functions with the same name, but from two different packages. How do I determine whether one of them is an extension of the other or both are extensions of the same function? I have in...

View Article

Convert array into matrix in place

Is there any way to convert an array into a matrix in place? Thank you. 7 posts - 4 participants Read full topic

View Article

Getting started - 'launch.json'

OK, I try to run a simple script (print(‘hello’)) from VSCode and whatever environment I’m in it says ‘open launch.json’ and whatever I click nothing happens. WTF IS THIS YOU INCOMPENTENT BASTARDS it...

View Article
Browsing all 2795 articles
Browse latest View live