Skip to content

Julia

Resources

Documentation

Tutorials

Cheatsheets

Context

Environment

Editors

Julia REPL

ans stores the result.

To print objects:

println()

To view dataframes, run:

vscodedisplay(ans)

Syntax

Functions

Broadcasting

Control flow

Symbols

Missing values

  • Missing Values ยท The Julia Language

    Julia provides support for representing missing values in the statistical sense. This is for situations where no value is available for a variable in an observation, but a valid value theoretically exists. Missing values are represented via the missing object, which is the singleton instance of the type Missing. missing is equivalent to NULL in SQL and NA in R, and behaves like them in most situations.

Pipes

Metaprogramming

  • Metaprogramming ยท The Julia Language

  • Macros

    Macros are necessary because they execute when code is parsed, therefore, macros allow the programmer to generate and include fragments of customized code before the full program is run.

Types

Subtypes and supertypes

# Subtype operator `<:(T1, T2)`
# -> returns true iff all values of type T1 are also of type T2.
Number <: Any 

subtypes(Any)
subtypes(Number)
subtypes(Real)
subtypes(Integer)
subtypes(Bool) # empty

supertypes(Bool)

?Vector{Float64} # Vector{T} is an alias for Array{T,1}
?Matrix{Float64} # Matrix{T} is an alias for Array{T,2}

Abstract and concrete types

TBD

Constructors

  • Constructors ยท The Julia Language

    Constructors are functions that create new objects --- specifically, instances of Composite Types. In Julia, type objects also serve as constructor functions: they create new instances of themselves when applied to an argument tuple as a function.

Arrays

Tuples

Packages and modules

Modules

  • Modules ยท The Julia Language

    • The recommended style is not to indent the body of the module, since that would typically lead to whole files being indented.

    • Also, it is common to use UpperCamelCase for module names (just like types), and use the plural form if applicable, especially if the module contains a similarly named identifier, to avoid name clashes.

Module lists

Some useful modules