Busy Developer's Guide to Julia

ted.neward@newardassociates.com | Blog: http://blogs.newardassociates.com | Github: tedneward | LinkedIn: tedneward

Objectives

Get to know Julia

The Julia Programming Language

... in a nutshell

The Julia Programming Language

What is it?

The Julia Programming Language

Julia distributed invocations

$ julia -p 2

julia> r = remotecall(rand, 2, 2, 2)
Future(2, 1, 4, nothing)

julia> s = @spawnat 2 1 .+ fetch(r)
Future(2, 1, 5, nothing)

julia> fetch(s)
2×2 Array{Float64,2}:
 1.18526  1.50912
 1.16296  1.60607

The Julia Programming Language

With some interesting metaprogramming support

julia> ex1 = Meta.parse("1 + 1")
:(1 + 1)

julia> dump(ex1)
Expr
  head: Symbol call
  args: Array{Any}((3,))
    1: Symbol +
    2: Int64 1
    3: Int64 1

julia> ex2 = Expr(:call, :+, 1, 1)
:(1 + 1)

julia> ex1 == ex2
true

julia> 

The Julia Programming Language

Hosting Julia in native code

#include <julia.h>
JULIA_DEFINE_FAST_TLS

int main(int argc, char *argv[])
{
    jl_init();

    /* run Julia commands */
    jl_eval_string("print(sqrt(2.0))");

    jl_atexit_hook(0);
    return 0;
}
$ gcc -o test -fPIC -I$JULIA_DIR/include/julia -L$JULIA_DIR/lib 
    -Wl,-rpath,$JULIA_DIR/lib test.c -ljulia

Getting Started with Julia

From 0 to Hello World

Getting Started with Julia

Installation

Getting Started with Julia

Hello, world

println("Hello, world!")

Run

julia hello.jl

Or run interactively

$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.9.1 (2023-06-07)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> print("Hello world")
Hello world
julia> 

Getting Started with Julia

Some interesting CLI switches

Summary

Julia is ...

Julia Resources

Where to go to get more

Julia Resources

Books

Julia Resources

Websites

Credentials

Who is this guy?