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

DataType and Type{T}

I don’t understand the following: julia> String isa Type{String} true julia> ("abc", String) isa Tuple{String, Type{String}} # ? false julia> ("abc", String) isa Tuple{String, Type{T} where...

View Article


Calling a function by argument type only

I have seen functions defined without argument values, just types for dispatch as so: function foo(::Int, n) return Int(n) end First question: What is this type-only argument style called? I can’t...

View Article


Image may be NSFW.
Clik here to view.

What is the command to find the keywords/functions of a Package such as in...

Greetings; As shown in the attachment, I tried to use names, names! and I tried [SHIFT]? to find keywords/functions . What is the correct keyword or script to view all keywords and their “docstrings”...

View Article

Re-writing a ruby side project into julia to learn

I have a few side projects which are running fine, but never let stability get in the way of learning a new language! I’ve been using julia for two weeks now and I figure an easy walk into learning...

View Article

Why do unicode arrows behave unexpectedly for variable names?

I’m going to keep this short as from what I’ve read on the topic the answer is likely “there’s ambiguity so it is turned off”. I was running in to the problem when doing some programming exercises and...

View Article


Finding the faces of a HyperRectangle along the nth dimension

I have a structure to hold a hyperrectangle. It is defined by intervals in each of the n dimensions. struct HyperRectangle min_bounds::Vector{Float32} max_bounds::Vector{Float32} end function...

View Article

I am surprised that promotion does not occur here

Consider the following: julia> [[1,2,3]//3,[1,2,3]*Int128(1)] 2-element Array{Array{T,1} where T,1}: Rational{Int64}[1//3, 2//3, 1//1] Int128[1, 2, 3] Julia cannot compute the type of the combined...

View Article

Dynamic indexing

Given a multi dimensional array A with N dimensions, I want to programmatically index so that : is used for all dimensions but for the k’th dimension it is fixed to a specific value v. Eg for N=4 and...

View Article


Passing 'global' functions

It is recommended to pass global variables to functions. What I wonder is whether it is good practice to pass functions as well. These functions can be declared in global scope or in outer (relative...

View Article


How to avoid name conflicts in MyPackage/runtests.jl

When testing my package I get errors that are not present when I run the failing test script in a new REPL, suggesting that namespace corruption is the problem. My runtests.jl setup is probably to...

View Article

Get generic constructor of parametric type

Is there a smart /easy way to get the generic constructor of a parametric type from its instance? I actually thought that this is a standard thing, but couldn’t find anything. abstract type...

View Article

2D graphics Library Recommendations

Hi, I am making a browser engine in Julia, could you please recommend a drawing/graphics library to use? 1 post - 1 participant Read full topic

View Article

Addind Options to Function

Hi everyone. I think this is really simple but I am not getting around it. I have this function Rps that does some computation. Now, to the final results I can add some corrections. I would like to be...

View Article


Image may be NSFW.
Clik here to view.

Replit.com PyPlot or Plots (Julia 1.3) vs. Plots in Pluto (Julia 1.6)

Greetings; I am a high school teacher trying to get students to use Julia 1.3 on Replit.com. Replit.com only has Julia 1.3, not 1.5 or newer. As shown in the attachment, the plot code works in Julia...

View Article

Writing a function that requires 1 argument, when using it julia thinks I put...

I have this in greet.jl module greetings export greet function greet(greeting::String) if greeting == "hello" | greeting == "Hello" returnmsg = "Good morning" elseif greeting == "goodbye" returnmsg =...

View Article


Segmentation fault when trying to make a custom sysimage

signal (11): Segmentation fault in expression starting at none:0 uv_write2 at /workspace/srcdir/libuv/src/unix/stream.c:1397 uv_write at /workspace/srcdir/libuv/src/unix/stream.c:1492 jl_uv_write at...

View Article

How to turn off @threads for ... while debugging

I’d like to turn off (like it is nothing) @threads macro in some case while debugging. Such as I want to pass optional parameter use_threads, and then how would I modify the following code not to use...

View Article


How to debug package unit tests in VS Code?

For package development, I run unit tests from package mode as (MyPackage) pkg> test MyPackage, but how do I start unittests.jl under debugger in VS Code? (I’m using Test package with @testset...

View Article

Failing to write a connection pool for Mongo

tldr; how does one write a connection pool to a database like mongo? As a side project to learn more about julia, I have a script which pulls a list from a mongo collection (database table), hits a...

View Article

A precise definition of what it means to be an instance of an abstract type

This question builds on What is difference between Type{T} and T - #16 by Henrique_Becker Are there any objections to the definition below? Based on the following two quotes from Types · The Julia...

View Article
Browsing all 2795 articles
Browse latest View live