Relative Content

Tag Archive for julia

Typed varargs in Julia

I Julia, I would like to define a function with a variable number of typed arguments
In particular I would like to overload the + operator in this way

Returning arithmetic progressions from Vector in Julia

I am new to Julia, and currently stuck on extracting arithmetic progressions from a Vector{Int64} in Julia. Suppose I have a Vector like [1, 4, 5, 3, 9, 21, 16, 2, 22, 54, 17, 23], and I want to extract all consecutive sequences of length three or more. So, from the above, I want to get [1, 2, 3, 4, 5] and [21, 22, 23] as separate vectors. What’s the most efficient way to do this (Preferably without iteration for large vectors)?